Solved

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

Posted on 2003-10-21
6
224 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Question to Pivot table 1 63
multiple reboots in a pc.. (event id 6006) 5 59
Best Google Chromebook AV solutions 5 29
Conversion Question 7 25
This is a quick article, and by no means should you quit your job today or plan to feed your family of 5 on a business idea. Starting a business takes work. This article will only give you the basic skeleton of understanding. Going into business for…
Whether you believe the “gig economy,” as it has been dubbed, is the next big economic paradigm shift (https://www.theguardian.com/commentisfree/2015/jul/26/will-we-get-by-gig-economy) or an overstated trend (http://www.wsj.com/articles/proof-of-a-g…
Notifications on Experts Exchange help you keep track of your activity and updates in one place. Watch this video to learn how to use them on the site to quickly access the content that matters to you.
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…

830 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