On the remote FTP server, I have a set of files in the directory remote.dir1
. I would like to move all the files in that directory to remote.dir2
.
I am using lftp
and was trying something like this:
lftp> mv remote.dir1/* remote.dir2/
It does not work and displays: Access failed: 550 remote.dir1/*: The filename, directory name, or volume label syntax is incorrect.
I also tried:
lftp> glob -a mv remote.dir1/* remote.dir2/
which displays the usage message: Usage: mv <file1> <file2>
However, moving single file works: lftp> mv remote.dir1/file1 remote.dir2/
As a last resort, we can construct a file containing a set of lftp mv
commands and source
it.
Are there any solutions I am not aware of?
Or, are there any capable command line tools for the task?
Edit:
I am restricted to FTP environment, so only solutions using FTP are acceptable due to the environmental constraint.
Best Answer
For documentation purpose, I will post the steps I used to complete the task. Any better solutions are much appreciated. ;-)
Note: this solution uses the
lftp
FTP client. You may have to install it on your machine before you can proceed.Solution:
Or, the one-linerTM: