Solved

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

Posted on 2003-10-21
6
208 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
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!
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…

746 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

14 Experts available now in Live!

Get 1:1 Help Now