if ( file.isFile() ) { uploadFile( file, new FTPFile(dstDir.toString() + "/" + file.getName()) ); }else { uploadDirectory( file, new FTPFile(dstDir + "/" + file.getName())); }
if ( !file.isDirectory() ) { uploadFile( file, new FTPFile(dstDir.toString(),file.getName()) ); }else { uploadDirectory( file, new FTPFile(dstDir.getPath(),file.getName(),true)); }
    public void uploadDirectory(FTPFile srcDir, FTPFile dstDir) throws IOException,FtpWorkflowException,FtpIOException {    	if ( !srcDir.isDirectory() )    		throw new FtpFileNotFoundException("Uploading: " + srcDir.getName() + " is not possible, it's not a directory!");    	makeDirectory(dstDir.toString());    	    	File[] files = srcDir.getFile().listFiles();    	List<FTPFile> ftpFiles = new ArrayList<FTPFile>();    	    	for ( File file : files)    		ftpFiles.add(new FTPFile(file));    	    	Collections.sort( ftpFiles );    	    	for ( FTPFile file : ftpFiles ) {    		if ( file.isFile() ) {    			uploadFile( file, new FTPFile(dstDir.toString() + "/" + file.getName()) );    		}else {    			uploadDirectory( file, new FTPFile(dstDir + "/" + file.getName()));    		}    	}    }