How to copy a file on the FTP server to a directory on the same server in Java?
I'm using Apache Commons FTP to upload a file. Before uploading I want to check if the file already exists on the server and make a backup from it to a backup directory on the same server. Does anyone know how to copy a file from a FTP server to a backup directory on the same server? public static void uploadWithCommonsFTP(File fileToBeUpload){ FTPClient f = new FTPClient(); FTPFile backupDirectory; try { f.connect(server.getServer()); f.login(server.getUsername(), server.getPassword()); FTPFile[] directories = f.listDirectories(); FTPFile[] files = f.listFiles(); for(FTPFile file:directories)