Solved

Xcopy OR ws_ftp script - merge FTP server's contents into single directory

Posted on 2003-10-21
6
213 Views
Last Modified: 2007-12-19
Hi
I have an FTP site with files in lots of different folders.
I need to do on eof the following:

1.  Copy all files and folders from FTP server to local machine using FTP client, but all files must go in one directory on local machine:
Server:
   \foo\file1.txt
   \foo\file2.txt
   \bar\file3.txt
   \bar\file4.txt
should be saved on the local machine all in one folder such as D:\ (not split in \foo, \bar as they were on the server).
This should/could be done using a WS-FTP or Robo FTP (or any other client) Script.  


-- OR --

2.  I will copy the exact structure from the FTP sevrer to the local machine.  I then need a batch file (xcopy based?) that will merge the contents of all the sub dirs into one folder:
   \foo\file1.txt
   \foo\file2.txt
   \bar\file3.txt
   \bar\file4.txt
should all be copied into D:\.



In both cases, if possible, file name conflicts should be resolved.


Thanks
Daniel
0
Comment
Question by:jasww
  • 4
  • 2
6 Comments
 
LVL 16

Expert Comment

by:_nn_
ID: 9592377
1. with ncftp (http://www.ncftpd.com/ncftp/), get a local copy (I think ncftpget -R should work) in a temporary location
2. with xxcopy (http://www.xxcopy.com/), "flatten" the temporary folder to the final one (see http://www.xxcopy.com/xxcopy16.htm for details)
0
 
LVL 16

Expert Comment

by:_nn_
ID: 9592386
Sidenote : xxcopy works over networks, but then, isn't free any longer. Hence my proposition to get the tree with ncftp.
0
 

Author Comment

by:jasww
ID: 9597507
Hi _nn_
Thanks for the posts.
However I can already use my (graphical) FTP client to download recursivly.  
I need a script for any FTP client that will download the contents of remote folders to one local folder.
Thanks
Daniel
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Accepted Solution

by:
_nn_ earned 250 total points
ID: 9597592
Well then, I'd propose using wget :
http://gnuwin32.sourceforge.net/packages/wget.htm

With a command line like following :

wget -r -nd ftp://user:pass@host.domain.tld//base/path

I'm getting the requested behavior, i.e., all files in the ftp tree in one local directory, and filename confilcts are resolved (no overwriting)
0
 

Author Comment

by:jasww
ID: 9597657
Brilliant _nn_ that's just what I need.
Many thanks.

Points for this Q guaranteed, but for an extra 50 points, can you tell me how to get wget to download the files and then delete them from the server?
The --delete-after removes them from the client.

Many thanks
Daniel
0
 
LVL 16

Expert Comment

by:_nn_
ID: 9598195
Hmmm, gave it a (long) thought, but didn't come with something useful yet. For sure, wget can't do that. cURL (http://curl.haxx.se/) can do a "retrieve and delete from server", unfortunately it's not built for dealing with directory trees. I'll keep trying to find something, but without guaranty...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Finding a job can be stressful - searches, resume tweaks, and networking events can be super boring. Luckily we're here to help you land your dream job!
With the shift in today’s hiring climate (http://blog.experts-exchange.com/ee-blog/5-tips-on-succeeding-in-the-new-gig-economy/?cid=Blog_031816), many companies are choosing to hire freelancers to get projects completed efficiently and inexpensively…
The Bounty Board allows you to request an article or video on any technical topic, or fulfill a bounty request to earn points. Watch this video to learn how to use the Bounty Board to get the content you want, earn points, and browse submitted bount…
Saved searches can save you time by quickly referencing commonly searched terms on any topic. Whether you are looking for questions you can answer or hoping to learn about a specific issue, a saved search can help you get the most out of your time o…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now