• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Numpty mget FTP command question.

wc2

Fingers like lightning
Joined
Aug 11, 2005
Messages
746
Likes received
7
Thanks received
6
Can someone provide the syntax for the mget command to copy every file and folder in the current remote folder to a local folder?

Current script

open #######
username
password
cd ..
cd ..
cd var/www/html
LCD c:\test
 
ftp <servername>
username: root
password:
ftp> bin
ftp> hash
ftp> cd /
ftp> prompt
ftp> mget *


HTH
 
If i need to script FTP, i just perform the action using a client such as Filezilla to do it first as it displays the commands executed in the query window. You can just copy these.

Not got a copy to check whether it will execute an 'all' command or just render a get for each file though.
 
ftp <servername>
username: root
password:
ftp> bin
ftp> hash
ftp> cd /
ftp> prompt
ftp> mget *


HTH

Thanks

That works for all the files.

Is there a way of telling to copy sub folders also?
 
Thanks

That works for all the files.

Is there a way of telling to copy sub folders also?

I don't think so...I seem to remember doing the same thing a while back, and in the end resorted to tar/gzipping the entire directory before transfer.
 
Thanks

That works for all the files.

Is there a way of telling to copy sub folders also?

not from the comand line, but any of the gui ftp clients will do recursive folders for you.
 
Thanks

That works for all the files.

Is there a way of telling to copy sub folders also?
If you can execute it on the sending machine, you could use a find to get all directories, pipe into xargs and an ftp with an mput; or a find to get all files and into a straight ftp. Chances of coding right first time????

Sorry but have to go for flight.
 

Advertisers

Back
Top