1
- I download all files in remote dir1/.
- They are downloaded to a directory which contains hundreds of files.
- I need to copy the file to a remote "archive" directory.
- I need to delete the file from dir1/ (above).
I'm having trouble finding a way to transfer a file from dir1/file to dir2/ using sftp protocol.
I"ve tried lftp
because I need to provide password non-interactively, and public/private keys aren't available for me. sftp
's rename
is available, but it requires public/private key auth.
I cannot use lftp
's ftpcopy
, cp
, or mv
. In the man page, get
seems promising:
get README -o ftp://some.host.org/debian-dir/
But authentication fails (assume "no password").
Because I am using the same server, it would be nice if lftp
just used the same credentials that I am currently using to log into the current server. But alas...
Is there a way to use a password for get
command? Is there a better way to do this?
I do not believe that rsync
is helpful here...
If it helps, I believe that the SFTP server is a Windows box.
For using password with OpenSSH
– Martin Prikryl – 2014-06-24T05:56:38.557sftp
, see http://stackoverflow.com/questions/5386482/how-to-run-the-sftp-command-with-a-password-from-bash-script"it would be nice if lftp just used the same credentials that I am currently using to log into the current server": So what you need SFTP for, if you are already logged onto the server? Use local (server's) file copying commands (
copy
on Windows). – Martin Prikryl – 2014-06-24T05:58:01.043I'm not logged onto the Windows desktop... I'm authenticated with
sftp
to thesftp
server. – Felipe Alvarez – 2014-06-25T01:04:48.390I am aware of
sshpass
and we are considering this as an alternative option. I was just wondering if there was any other way that I had not yet considered. – Felipe Alvarez – 2014-06-25T01:05:25.887So, what's wrong about
sshpass
? Why it's only alternative for you? Please make your question more clear. Also do you need to copy (get
) or move the file? Why cannot you uselftp
'smv
command? – Martin Prikryl – 2014-06-25T07:13:45.353I realize this post is a little old but the solution I found seemed worth posting here for future readers. – Woz – 2017-10-26T04:15:15.007
Thanks @Woz. What was the solution that you found? – Felipe Alvarez – 2017-10-31T06:09:54.497