Ralph Atallah - 2009-07-21

I am using ScpClient's powerful InputStream get() and put() to transfer file from remote to remote servers.   It works well except that it leaves a copy of the file in the default folder where the application is running. 

This is undesirable.   Is there an automatic way of having this file be deleted instead of having to do it manually with additional commands? 

Also, the localFile parameter in put(InputStream in, long length, String localFile, String remoteFile) seems to make no difference in the behavior of the function.

Below are details:
...
            ScpClient scpSource = sshSource.openScpClient();
            ScpClient scpDest = sshDest.openScpClient();
            SftpClient sftpDest = sshDest.openSftpClient();

            InputStream in = scpSource.get(filename);
            sftpDest.mkdirs(destFilename);
            scpDest.put(in, size, "whatever.txt", destFilePath);
            in.close();
...
The file is copied correctly from source to destination, but a copy of it appears under /root on the local server.

Thanks.