Many times I am challenged to move many similar files from one server to another. Either I have to remote-desktop on to the server (Windows), or have a session on the server (AIX, Linux). In these situations, I do not have a nice GUI utility, like FTP Voyager, setup to move my files. There are some good basic commands in FTP that make life easier to move many like files.
C:\ ftp <my server name>
ftp> bin
ftp> prompt no
ftp> mget <start of the like files> *
Below are commands that I use to move multiple files at in a couple commands.
binary or bin: when you set to binary mode, you’ll receive a message “200 Type set to I”. The default mode for FTP is ASCII. Binary mode transmits the raw bytes of a file. This is useful when moving zipped or executable file. If you transmit your executable or zipped file in ASCII mode, you may find it corrupted on the receiving server. To save time & typing, you can type “bin”, and the FTP utility will recognize it as the command “binary”.
prompt no: by default the prompt is set on to check if you want the download the file. When you set your prompt mode to no, your will get an message “Interactive mode OFF”. By setting the prompt to no, the FTP utility will automatically download multiple files without prompting.
Below is an example of being prompted for each file & why you may want to avoid this (you have to type either y or n for each file):
— very bad if you have to move hundreds to thousands of files
mget: this command can retrieve multiple files at a time. View some of the example below:
FTP> mget file01 file02 file03
separate each file with a space
FTP> mget filename*
FTP> mget *.txt
start or finish with the common characters in the file name, and the star (*) can be used as a wildcard character
mput: this command is used like mget to upload multiple file to the remote computer
FTP> mput file01 file02 file03
separate each file with a space
FTP> mput filename*
FTP> mput *.txt
start or finish with the common characters in the file name, and the star (*) can be used as a wildcard character
Why I write this:
When I started working more with linux & AIX operating systems, I remember spending a lot of time to put together all the commands that I would need to upload system patches or to script the movement of log files. This week, cleaning up my personal folder, I found the notes I had to put these together. My hope is that these notes helps someone cut down on the number of message board they have to search to find the commands need to accomplish these tasks.
I cannot thank you enough for the blog post.Really thank you! Awesome.
Thanks for the kind words & thanks for visiting!!!
Thank you sharing, this is the fantastic article post.Really appreciate it! Great.
You can also use mdelete to delete multiple files, but use it with caution!
prompt no for the win!!
Thanks for the info
Wow! wow! wow! Really appreciated.
And Thanks for Reading!
Mget *.txt will fetch all the txt files from the server. If I need some 50 to 60 .txt files alone leaving older .txt file how can I perform the mget command?
Sorry, this is not an easy answer. MGET does not read timestamps, only file names. You will probably need to script something to create a tempfile of the files you wish to move. Hope that helps.
http://stackoverflow.com/questions/28282202/unix-ftp-connection-get-file-based-on-time-stamp
Thanks for the information.
And thank you for reading!!!
thank you so much