Solved

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

Posted on 2003-10-21
6
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

 
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

Phishing is at the top of most security top 10 efforts you should be pursuing in 2016 and beyond. If you don't have phishing incorporated into your Security Awareness Program yet, now is the time. Phishers, and the scams they use, are only going to …
Stuck in voice control mode on your Amazon Firestick?  Here is how to turn it off!!!
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…

724 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