Text Print Entire Directory Tree including File Names from a FTPDirectory

I

ifiaz

Hello,

I am looking for a way to get the ENTIRE (or at a given depth)
directory tree of a FTP folder and files from an FTP server. The
listing should include file sizes and modified dates, etc. as much
info as possible through some configurable parameters. The same script
may be able to be used on a local drive as well.

I have managed to do this FTP directory task using the
http://www.ftprush.com/ftp-directory-tree.html application. This
application is pretty cool and it did exactly what I wanted.

**********
My question is how can I do this using a Perl Script or any other free
utility from command line.???
**********

I am sure someone out there who must have written such stuff already.
I do not wish to reinvent the wheel and even I am not capable to write
such a script myself.

Any pointers and help is much appreciated. Thank you.

The ftprush program listed something like this (which is SO...
COOL...).

/New Folder/ [345.4 M]
|-Annexures [67.7 M]
| >|-Annexure A2- bbbb Group ppt [2.0 M]
| >| >|-Presentation on Group.ppt (2.0 M)
| >|
| >|-Annexure B1- Copy of Annual Accounts bbb-vii [39.2 M]
| >| >|-vii05s-us.pdf (10.7 M)
| >| >|-vii-rapport-annuel-2006-en (2).pdf (27.8 M)
| >| >|-bbbHSA audited financials 2006.pdf (659.5 k)
| >|
| >|-Annexure C - Quality Manual and safety [540.5 k]
| >| >|-Attachement A - bbb Quality Manual.doc (540.5 k)
| >|
| >|-Annexure C1- Safety and Security [221.5 k]
| >| >|-Attachement C - S&S Manual.doc (221.5 k)
| >|
| >|-Annexure D-Insurance Certificate [82.3 k]
| >| >|-Aviation Insurance -11-07.pdf (82.3 k)
....
....
 
J

Jim Gibson

ifiaz said:
Hello,

I am looking for a way to get the ENTIRE (or at a given depth)
directory tree of a FTP folder and files from an FTP server. The
listing should include file sizes and modified dates, etc. as much
info as possible through some configurable parameters. The same script
may be able to be used on a local drive as well.

I have managed to do this FTP directory task using the
http://www.ftprush.com/ftp-directory-tree.html application. This
application is pretty cool and it did exactly what I wanted.

**********
My question is how can I do this using a Perl Script or any other free
utility from command line.???
**********

I am sure someone out there who must have written such stuff already.
I do not wish to reinvent the wheel and even I am not capable to write
such a script myself.

Any pointers and help is much appreciated. Thank you.

Use the Net::FTP module and its 'dir' command to get a directory
listing from an FTP server. To get a full directory tree, you will have
to parse the return from the dir command and follow directory links.
 
I

ifiaz

Use the Net::FTP module and its 'dir' command to get a directory
listing from an FTP server. To get a full directory tree, you will have
to parse the return from the dir command and follow directory links.

Could someone point me to a code which is already available on the
web.

I tried looking around the web and found this among a few others:

http://www.wellho.net/resources/ex.php4?item=p616/ftp2

But, so far nothing worked for me.

The above script works up to a successful login, and then afterwards
nothing is printed out.

This is what I get.

$ /cygdrive/c/x/scripts/recursiveftp.pl
Search FTP site!
Site name: 220.227.165.***
Login name: hidden
Password: hidden
Directory to search from: /New Folder/
/New Folder/
files, total size bytes

Please point me to a workable code on the net as I don't think I can
write a successful one myself.
 
I

ifiaz

Could someone point me to a code which is already available on the
web.

I tried looking around the web and found this among a few others:

http://www.wellho.net/resources/ex.php4?item=p616/ftp2

But, so far nothing worked for me.

The above script works up to a successful login, and then afterwards
nothing is printed out.

This is what I get.

$ /cygdrive/c/x/scripts/recursiveftp.pl
Search FTP site!
Site name: 220.227.165.***
Login name: hidden
Password: hidden
Directory to search from: /New Folder/
/New Folder/
 files, total size  bytes

Please point me to a workable code on the net as I don't think I can
write a successful one myself.

I did a vardump on the $jpdir and noticed that it returns DOS type
directory list. But, the code in http://www.wellho.net/resources/ex.php4?item=p616/ftp2
expects a unix type dir list.

How can I make the code work with the DOS type Directory Listing. Or,
Are there any other better code out there which can take care of both
types of dir return values.

Here is what I got for the vardump of $jdir:

$Data::Dumper::Indent = 3; # pretty print with array indices
print Dumper($jpdir);

Directory to search from: $VAR1 = [
#0
'01-22-09 06:55PM <DIR> Annexure A2- xxx
Group ppt',
#1
'01-22-09 06:56PM <DIR> Annexure B1- Copy of
Annual Accounts xxx',
#2
'01-22-09 06:56PM <DIR> Annexure C - Quality
Manual and safety',
.... and so on

Please help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top