Copying multiple folders to local machine (don't know folder names)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Copying multiple folders to local machine (don't know folder names)
# 1  
Old 12-13-2006
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!
# 2  
Old 12-13-2006
Look for a recursive option to mget in it's manpage. I would, but I don't have mget.
# 3  
Old 12-13-2006
You can use ncftp to do recursive gets on a remote ftp server. Just issue "get -R *"
# 4  
Old 12-13-2006
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
# 5  
Old 12-14-2006
The common wget commandline download tool has a recursive option. It can handle HTTP and FTP.
# 6  
Old 06-12-2008
Why don't you use rsync it has all the functionality what you are looking for.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy local files to single remote host but multiple folders using rsync

I'm trying to copy a file myfile.scr from my local Linux server to multiple folders on remote AiX server using single rsync command. Below command helps me copy the file "myfile.scr" from my localhost to a remote host folder "/app/deployment/tmpfiles" rsync --delay-updates -F --compress... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. UNIX for Beginners Questions & Answers

Mirror a folder from the Internet to local machine

I have a machine in my LAN that runs Ubuntu and I have full access in it. There is another PC on the Internet that has a public IP eg 3.3.3.3 and it servers as https server and access to it is by username and password. On the remote PC all i have is access through https using username/passwd. ... (3 Replies)
Discussion started by: atux_null
3 Replies

3. Shell Programming and Scripting

Execute multiple files in multiple folders and also output on same folder

How to execute multiple files in multiple folders and also output to be generated in the same folder? Hello Team, I have a path like Sanity_test/*/* and it has around 100+ folders inside with files. I would like to run/execute those files and output of execution to be placed on same /... (1 Reply)
Discussion started by: pushpabuzz
1 Replies

4. UNIX for Dummies Questions & Answers

Creating a sub-folder in multiple folders

Hi I've been trying to find an answer to this question and was hoping someone would be able to help me. I want to add a sub-folder to to an existing structure: for example /toys/toy_1/new /toys/toy_2/new /toys/toy_3/new There are humdreds of theses folders - what i want to do is add a... (2 Replies)
Discussion started by: LouSan
2 Replies

5. Shell Programming and Scripting

Copying files from various folders to similar folder structure in another location

Hi, I need to write a script the has to copy the files from folders and subfolders to the same folder structure located in another location. Ex: mainfolder1 file1,file2,file3 subfolder1(file1,etc) subfolder2(file1,etc) to another folder location of same folder structure. rsync is not... (7 Replies)
Discussion started by: Raji Perumal
7 Replies

6. UNIX for Dummies Questions & Answers

Unzipping a file which has multiple folders and each folder has the files with same name in it

Hi, I have a zipped file a.zip. This has got multiple folders in it say x and y. x contains a.txt and y contains a.txt. Is it possible to unzip this file and have the 2 files extracted and rename them to unique names. Thanks in advance. (1 Reply)
Discussion started by: arunkesi
1 Replies

7. Solaris

Copying from server to a local machine

Hi, I am trying to copy a file from oracle home on a unix platform to my local machine. I think i can use ftp but i am not sure of the exact syntax and way i should write this. Can someone help please? (2 Replies)
Discussion started by: dollypee
2 Replies

8. UNIX for Advanced & Expert Users

Move folders from Multiple remote Servers to my local computer

I have 20 Servers (They are Windows 2003) that I remote every day using names or IP address and type in my username & Password then copy folders manually to my local computer. I'm wondering if i can just run script(s) from my local computer to do this job without using FTP(because of security... (5 Replies)
Discussion started by: idiazza
5 Replies

9. UNIX for Dummies Questions & Answers

copying same file multiple times with different names

hi, I am copying a file from 1 folder to another in /bin/sh. if the file already exists there, it should get copied as filename1. again if copying next time it shouldget copied as filename2.. , filename3..so on.. The problem is i am able to get uptil filename1.. but how do i know what... (6 Replies)
Discussion started by: blackcat
6 Replies

10. OS X (Apple)

Automated command ; extracting files from folders and copying them into a single folder

Hello everyone, I'm running Mac OS X Leopard (10.5.8) and I want to use the Terminal to help automate this tedious and laborious command for me: I need to extract all of the .m4p files in my "iTunes Music" folder which reside in folders of the artist, and then subfolders for the albums and... (2 Replies)
Discussion started by: qcom
2 Replies
Login or Register to Ask a Question