The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Copying files from a remote server to local system with cygwin patwa UNIX for Dummies Questions & Answers 3 06-12-2008 04:49 AM
Automatically copying files from server to local drive? Sepia UNIX for Dummies Questions & Answers 1 06-05-2008 09:24 PM
Copying specific folders from one server to another chris1234 Shell Programming and Scripting 4 12-18-2007 03:44 PM
delete all folders/files and keep only the last 10 in a folder melanie_pfefer Shell Programming and Scripting 3 11-17-2006 11:33 AM
Copying Folders without some folders... ;-) chimpu UNIX for Dummies Questions & Answers 5 04-26-2004 09:25 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-13-2006
Registered User
 

Join Date: Dec 2006
Posts: 1
Copying multiple folders to local machine (don't know folder names)

Hi.
I'm trying to copy multiple folders from the remote machine to the local machine. I wrote a batch file to run an ftp window.
The problem I am having is that the only command to copy files is mget *, and this copies only files, not folders.

For example, ftp ts555
cd ts555/test
' test has an unspecified number of folders, anywhere from 1 - 6

I cannot type mget * because it will not systematically go into each folder and get the files, it will just give me an error.

I do not know the names of the folders in ts555 because they change daily.
I somehow need to access all the files in all the folders in ts555

Thank you!
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-13-2006
Registered User
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 923
Look for a recursive option to mget in it's manpage. I would, but I don't have mget.
Reply With Quote
  #3 (permalink)  
Old 12-13-2006
Registered User
 

Join Date: Dec 2006
Posts: 22
You can use ncftp to do recursive gets on a remote ftp server. Just issue "get -R *"
Reply With Quote
  #4 (permalink)  
Old 12-13-2006
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,102
Quote:
Originally Posted by Corona688
Look for a recursive option to mget in it's manpage. I would, but I don't have mget.
mget ist not a command but a subcommand of ftp, therefore you probably "have" it (as long as you didn't purge the ftp command from your system) and it neither has a manpage nor a recursive-option.

The bad news is there is no way to do it with ftp in a simple or straightforward way. ftp was designed as an interactive program and hence is simply not built with your purpose in mind. It may be possible - with finite, but probably pretty high amount of work to put in - to script a solution around ftp, but i wouldn't suggest doing that.

What you can do, though, is to use r-commands (rcp) or their securized counterparts (scp, ...). Look at the manpages of rcp and/or scp and decide for yourself if they fit your purpose.

Another way is to create a tar-file of the subtree and use ftp to transfer it from one machine to another, then use tar to extract it there. While this is a simple and straightforward solution it needs some (depending on the amount of data you want to transfer) and maybe even a lot of disk space. Roughly the size of the tar archive is as big as the single files summed up (check with du to get a picture, if you want to transfer one subtree /transfer/this then issue

du -ks /transfer/this

to get the number of kbytes. The same number you will need again for the tar archive.

bakunin
Reply With Quote
  #5 (permalink)  
Old 12-14-2006
Registered User
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 923
The common wget commandline download tool has a recursive option. It can handle HTTP and FTP.
Reply With Quote
  #6 (permalink)  
Old 06-12-2008
Registered User
 

Join Date: Apr 2008
Posts: 3
Why don't you use rsync it has all the functionality what you are looking for.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0