Computing.Net > Forums > Windows 2000 > FTP script download recursive dirs

FTP script download recursive dirs

Reply to Message Icon

Original Message
Name: ikerstges
Date: February 28, 2007 at 02:23:03 Pacific
Subject: FTP script download recursive dirs
OS: Windows 2000
CPU/Ram: PIV/512Mb
Model/Manufacturer: Dell/Optiplex GX240
Comment:

Hiall,

I need to download all files from a FTP location, INCLUDING any subdirectories. Currently, the folders are like:

ROOT
|
--Folder1
|
--Folder2

But tomorrow, it can be very well possible that a new folder gets created (Folder29 or so..). But there is no way to know if/when this is indeed the case, nor which name the new folder will have..

I can make a script that will download any files from ROOT, including the files from Folder1 and Folder2. I can run this script daily, but it would miss the files in any new folder.

Any suggestions?


Report Offensive Message For Removal

Response Number 1
Name: FishMonger
Date: February 28, 2007 at 10:30:24 Pacific
Subject: FTP script download recursive dirs
Reply: (edit)

You didn't specify the scripting language that you want to use, but this is extreamly easy to do in Perl.

================================================
#!perl

use Net::FTP::Recursive;

$ftp = Net::FTP::Recursive->new('www.mysite.com', Debug => 0);
$ftp->login('username', 'password');
$ftp->rget();
$ftp->quit;



Report Offensive Follow Up For Removal

Response Number 2
Name: ikerstges
Date: February 28, 2007 at 12:55:08 Pacific
Subject: FTP script download recursive dirs
Reply: (edit)

Hi FishMonger,

Thanks for your response! This looks extremely easy indeed! Wow..

I know I should study perl or others, but unfortunately, I don“t know any Perl at all.

I hope that my request can be realised just on the commandline in Windows 2000, with use of a plain ftp-scriptfile.


Report Offensive Follow Up For Removal

Response Number 3
Name: Mechanix2Go
Date: March 4, 2007 at 05:21:36 Pacific
Subject: FTP script download recursive dirs
Reply: (edit)

Try this:

::== T5.bat == gets all files from ftp site
@echo off
setLocal EnableDelayedExpansion

> #.ftp echo o golden-triangle.com
>> #.ftp echo username
>> #.ftp echo password
>> #.ftp echo bin
>> #.ftp echo ls -aR
>> #.ftp echo bye

ftp -s:#.ftp |findstr /b "./" > flog

> #.ftp echo o golden-triangle.com
>> #.ftp echo username
>> #.ftp echo password
>> #.ftp echo bin
>> #.ftp echo prompt

for /f "tokens=1 delims=:" %%A in (flog) do (
>> #.ftp echo mget %%A/*.*
)

>> #.ftp echo bye

ftp -s:#.ftp
::==


=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal

Response Number 4
Name: Mechanix2Go
Date: March 18, 2007 at 02:47:12 Pacific
Subject: FTP script download recursive dirs
Reply: (edit)

No comment?


=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: FTP script download recursive dirs

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software