jbackup/src/main/java/org/jbundle/jbackup/destination/FtpDestination.java
public int changeDirectory(String strPath) throws IOException
	{
		int iLastSlash = strPath.lastIndexOf('/');
		if (iLastSlash != -1)
			strPath = strPath.substring(0, iLastSlash);
		else
			strPath = "";
		String strFTPPath = "";
		if (m_strRootFTPDirectory.length() > 0)
		{
			if (!strFTPPath.startsWith(File.separator))
			strFTPPath = File.separator + m_strRootFTPDirectory;
			if (strPath.length() > 0)
				if (!strFTPPath.endsWith(File.separator))
					strFTPPath += File.separator;
		}
		strFTPPath += strPath;
		if (strFTPPath.equals(m_strLastPath))
			return FTPReply.COMMAND_OK;		// Already in the current directory.
		if (DEBUG)
			System.out.println("Change working directory to: " + strFTPPath);
		int iError = FTPReply.COMMAND_OK;
		if (!m_client.changeWorkingDirectory(strFTPPath)) 
		{
			if (!m_client.makeDirectory(strFTPPath)) 
				iError = FTPReply.FILE_ACTION_NOT_TAKEN;
			else if (!m_client.changeWorkingDirectory(strFTPPath))
				iError = FTPReply.FILE_ACTION_NOT_TAKEN;
		}
		m_strLastPath = strFTPPath;

		return iError;
	}
public int changeDirectory(String strPath) throws IOException
	{
		int iLastSlash = strPath.lastIndexOf('/');
		if (iLastSlash != -1)
			strPath = strPath.substring(0, iLastSlash);
		else
			strPath = "";
		String strFTPPath = "";
		if (m_strRootFTPDirectory.length() > 0)
		{
			if (!strFTPPath.startsWith(File.separator))
			strFTPPath = File.separator + m_strRootFTPDirectory;
			if (strPath.length() > 0)
				if (!strFTPPath.endsWith(File.separator))
					strFTPPath += File.separator;
		}
		strFTPPath += strPath;
		if (strFTPPath.equals(m_strLastPath))
			return FTPReply.COMMAND_OK;		// Already in the current directory.
		if (DEBUG)
			System.out.println("Change working directory to: " + strFTPPath);
		int iError = FTPReply.COMMAND_OK;
		if (!m_client.changeWorkingDirectory(strFTPPath)) 
		{
			if (!m_client.makeDirectory(strFTPPath)) 
				iError = FTPReply.FILE_ACTION_NOT_TAKEN;
			else if (!m_client.changeWorkingDirectory(strFTPPath))
				iError = FTPReply.FILE_ACTION_NOT_TAKEN;
		}
		m_strLastPath = strFTPPath;

		return iError;
	}
public int changeDirectory ( String strPath ) throws IOException { int iLastSlash = strPath . lastIndexOf ( ' ' ) ; if ( iLastSlash != - 1 ) strPath = strPath . substring ( 0 , iLastSlash ) ; else strPath = "" ; String strFTPPath = "" ; if ( m_strRootFTPDirectory . length ( ) > 0 ) { if ( ! strFTPPath . startsWith ( File . separator ) ) strFTPPath = File . separator + m_strRootFTPDirectory ; if ( strPath . length ( ) > 0 ) if ( ! strFTPPath . endsWith ( File . separator ) ) strFTPPath += File . separator ; } strFTPPath += strPath ; if ( strFTPPath . equals ( m_strLastPath ) ) return FTPReply . COMMAND_OK ; // Already in the current directory. if ( DEBUG ) System . out . println ( "Change working directory to: " + strFTPPath ) ; int iError = FTPReply . COMMAND_OK ; if ( ! m_client . changeWorkingDirectory ( strFTPPath ) ) { if ( ! m_client . makeDirectory ( strFTPPath ) ) iError = FTPReply . FILE_ACTION_NOT_TAKEN ; else if ( ! m_client . changeWorkingDirectory ( strFTPPath ) ) iError = FTPReply . FILE_ACTION_NOT_TAKEN ; } m_strLastPath = strFTPPath ; return iError ; }
/*
Change to this directory.
/ * Change to this directory .