lftp remote copy file from one directory to another
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
- 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.
sftp
|
show 2 more comments
- 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.
sftp
For using password with OpenSSHsftp
, see stackoverflow.com/questions/5386482/…
– Martin Prikryl
Jun 24 '14 at 5:56
"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
Jun 24 '14 at 5:58
I'm not logged onto the Windows desktop... I'm authenticated withsftp
to thesftp
server.
– Felipe Alvarez
Jun 25 '14 at 1:04
I am aware ofsshpass
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
Jun 25 '14 at 1:05
So, what's wrong aboutsshpass
? 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
Jun 25 '14 at 7:13
|
show 2 more comments
- 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.
sftp
- 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.
sftp
sftp
asked Jun 24 '14 at 3:26
Felipe AlvarezFelipe Alvarez
1,13531832
1,13531832
For using password with OpenSSHsftp
, see stackoverflow.com/questions/5386482/…
– Martin Prikryl
Jun 24 '14 at 5:56
"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
Jun 24 '14 at 5:58
I'm not logged onto the Windows desktop... I'm authenticated withsftp
to thesftp
server.
– Felipe Alvarez
Jun 25 '14 at 1:04
I am aware ofsshpass
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
Jun 25 '14 at 1:05
So, what's wrong aboutsshpass
? 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
Jun 25 '14 at 7:13
|
show 2 more comments
For using password with OpenSSHsftp
, see stackoverflow.com/questions/5386482/…
– Martin Prikryl
Jun 24 '14 at 5:56
"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
Jun 24 '14 at 5:58
I'm not logged onto the Windows desktop... I'm authenticated withsftp
to thesftp
server.
– Felipe Alvarez
Jun 25 '14 at 1:04
I am aware ofsshpass
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
Jun 25 '14 at 1:05
So, what's wrong aboutsshpass
? 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
Jun 25 '14 at 7:13
For using password with OpenSSH
sftp
, see stackoverflow.com/questions/5386482/…– Martin Prikryl
Jun 24 '14 at 5:56
For using password with OpenSSH
sftp
, see stackoverflow.com/questions/5386482/…– Martin Prikryl
Jun 24 '14 at 5:56
"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
Jun 24 '14 at 5:58
"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
Jun 24 '14 at 5:58
I'm not logged onto the Windows desktop... I'm authenticated with
sftp
to the sftp
server.– Felipe Alvarez
Jun 25 '14 at 1:04
I'm not logged onto the Windows desktop... I'm authenticated with
sftp
to the sftp
server.– Felipe Alvarez
Jun 25 '14 at 1:04
I 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
Jun 25 '14 at 1:05
I 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
Jun 25 '14 at 1:05
So, 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 use lftp
's mv
command?– Martin Prikryl
Jun 25 '14 at 7:13
So, 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 use lftp
's mv
command?– Martin Prikryl
Jun 25 '14 at 7:13
|
show 2 more comments
1 Answer
1
active
oldest
votes
@Felipe - I dunno what I was smoking when I posted my comment, I can't believe I didn't finish typing my post, sorry about that.
When I was trying to get lftp working to transfer files between my remote server and local computer I ran into authentication issues after starting lftp, I could successfully connect to my server with lftp but I couldn't run any commands, everything would play out like the example below.
lftp 222.222.222.222:~> ls
'ls' at 0 [Connecting...]
'ls' at 0 [Delaying before reconnect: 35]
Exit out of lftp and back to the normal command line, then try connecting with ssh using this command, enter your password if prompted -
ssh -p PORT# username@xxx.xxx.xxx.xxx
If you are able to connect to your remote server and are able to list the contents of the current folder, you should now be able to use lftp without the 'connecting' timeout error.
I have attached the script I use to transfer files/folders between my remote and local computers. The script isn't completely finalized but it does work as intended. Remember to edit the host,port#, username/password, local and remote directories (additionally lines 23,24 and 25 might need to be commented out, but don't try unless you run into problems)
At some point I would like the script to be able to pull a list of folders from another text file and then transfer each folder listed to my local computer however found and edited for my needs run the script attached in the link below.
To remove the files from the remote server after transferring you can use this flag with the mirror command.
'mirror --remove-source-files'
lftp-mirror.sh - script
The LFTP Manual might be helpful with getting the right command and aurguments for your particular situation.
LFTP Manual
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f772607%2flftp-remote-copy-file-from-one-directory-to-another%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
@Felipe - I dunno what I was smoking when I posted my comment, I can't believe I didn't finish typing my post, sorry about that.
When I was trying to get lftp working to transfer files between my remote server and local computer I ran into authentication issues after starting lftp, I could successfully connect to my server with lftp but I couldn't run any commands, everything would play out like the example below.
lftp 222.222.222.222:~> ls
'ls' at 0 [Connecting...]
'ls' at 0 [Delaying before reconnect: 35]
Exit out of lftp and back to the normal command line, then try connecting with ssh using this command, enter your password if prompted -
ssh -p PORT# username@xxx.xxx.xxx.xxx
If you are able to connect to your remote server and are able to list the contents of the current folder, you should now be able to use lftp without the 'connecting' timeout error.
I have attached the script I use to transfer files/folders between my remote and local computers. The script isn't completely finalized but it does work as intended. Remember to edit the host,port#, username/password, local and remote directories (additionally lines 23,24 and 25 might need to be commented out, but don't try unless you run into problems)
At some point I would like the script to be able to pull a list of folders from another text file and then transfer each folder listed to my local computer however found and edited for my needs run the script attached in the link below.
To remove the files from the remote server after transferring you can use this flag with the mirror command.
'mirror --remove-source-files'
lftp-mirror.sh - script
The LFTP Manual might be helpful with getting the right command and aurguments for your particular situation.
LFTP Manual
add a comment |
@Felipe - I dunno what I was smoking when I posted my comment, I can't believe I didn't finish typing my post, sorry about that.
When I was trying to get lftp working to transfer files between my remote server and local computer I ran into authentication issues after starting lftp, I could successfully connect to my server with lftp but I couldn't run any commands, everything would play out like the example below.
lftp 222.222.222.222:~> ls
'ls' at 0 [Connecting...]
'ls' at 0 [Delaying before reconnect: 35]
Exit out of lftp and back to the normal command line, then try connecting with ssh using this command, enter your password if prompted -
ssh -p PORT# username@xxx.xxx.xxx.xxx
If you are able to connect to your remote server and are able to list the contents of the current folder, you should now be able to use lftp without the 'connecting' timeout error.
I have attached the script I use to transfer files/folders between my remote and local computers. The script isn't completely finalized but it does work as intended. Remember to edit the host,port#, username/password, local and remote directories (additionally lines 23,24 and 25 might need to be commented out, but don't try unless you run into problems)
At some point I would like the script to be able to pull a list of folders from another text file and then transfer each folder listed to my local computer however found and edited for my needs run the script attached in the link below.
To remove the files from the remote server after transferring you can use this flag with the mirror command.
'mirror --remove-source-files'
lftp-mirror.sh - script
The LFTP Manual might be helpful with getting the right command and aurguments for your particular situation.
LFTP Manual
add a comment |
@Felipe - I dunno what I was smoking when I posted my comment, I can't believe I didn't finish typing my post, sorry about that.
When I was trying to get lftp working to transfer files between my remote server and local computer I ran into authentication issues after starting lftp, I could successfully connect to my server with lftp but I couldn't run any commands, everything would play out like the example below.
lftp 222.222.222.222:~> ls
'ls' at 0 [Connecting...]
'ls' at 0 [Delaying before reconnect: 35]
Exit out of lftp and back to the normal command line, then try connecting with ssh using this command, enter your password if prompted -
ssh -p PORT# username@xxx.xxx.xxx.xxx
If you are able to connect to your remote server and are able to list the contents of the current folder, you should now be able to use lftp without the 'connecting' timeout error.
I have attached the script I use to transfer files/folders between my remote and local computers. The script isn't completely finalized but it does work as intended. Remember to edit the host,port#, username/password, local and remote directories (additionally lines 23,24 and 25 might need to be commented out, but don't try unless you run into problems)
At some point I would like the script to be able to pull a list of folders from another text file and then transfer each folder listed to my local computer however found and edited for my needs run the script attached in the link below.
To remove the files from the remote server after transferring you can use this flag with the mirror command.
'mirror --remove-source-files'
lftp-mirror.sh - script
The LFTP Manual might be helpful with getting the right command and aurguments for your particular situation.
LFTP Manual
@Felipe - I dunno what I was smoking when I posted my comment, I can't believe I didn't finish typing my post, sorry about that.
When I was trying to get lftp working to transfer files between my remote server and local computer I ran into authentication issues after starting lftp, I could successfully connect to my server with lftp but I couldn't run any commands, everything would play out like the example below.
lftp 222.222.222.222:~> ls
'ls' at 0 [Connecting...]
'ls' at 0 [Delaying before reconnect: 35]
Exit out of lftp and back to the normal command line, then try connecting with ssh using this command, enter your password if prompted -
ssh -p PORT# username@xxx.xxx.xxx.xxx
If you are able to connect to your remote server and are able to list the contents of the current folder, you should now be able to use lftp without the 'connecting' timeout error.
I have attached the script I use to transfer files/folders between my remote and local computers. The script isn't completely finalized but it does work as intended. Remember to edit the host,port#, username/password, local and remote directories (additionally lines 23,24 and 25 might need to be commented out, but don't try unless you run into problems)
At some point I would like the script to be able to pull a list of folders from another text file and then transfer each folder listed to my local computer however found and edited for my needs run the script attached in the link below.
To remove the files from the remote server after transferring you can use this flag with the mirror command.
'mirror --remove-source-files'
lftp-mirror.sh - script
The LFTP Manual might be helpful with getting the right command and aurguments for your particular situation.
LFTP Manual
edited Nov 4 '17 at 1:24
answered Nov 4 '17 at 1:12
WozWoz
158111
158111
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f772607%2flftp-remote-copy-file-from-one-directory-to-another%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
For using password with OpenSSH
sftp
, see stackoverflow.com/questions/5386482/…– Martin Prikryl
Jun 24 '14 at 5:56
"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
Jun 24 '14 at 5:58
I'm not logged onto the Windows desktop... I'm authenticated with
sftp
to thesftp
server.– Felipe Alvarez
Jun 25 '14 at 1:04
I 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
Jun 25 '14 at 1:05
So, 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
Jun 25 '14 at 7:13