P is for Practical | |
PerlMonks |
ftp directoriesby mbond (Beadle) |
on Sep 14, 2001 at 20:00 UTC ( [id://112452]=perlquestion: print w/replies, xml ) | Need Help?? |
mbond has asked for the wisdom of the Perl Monks concerning the following question:
I wrote a script to connect to 3 different servers via net::ftp. The program checks to see wether an entry in the home directory is a file or a directory.
If it is a directory, deletes the directory and puts a file on the server with the same name. This is to fix a bug with another program that we have to use (and for the time being have to live with the bug). The 3 servers are running on 3 different OS's (NT, Solaris, Linux) and my question is: Is there an easy way to determine if an entry in the returned list from $ftp->dir; is a directory or file? Right now i recursively check based on the first character of each line returned if it is a unix box OR for the <DIR> tag if it is on the windows box. It was a quick hack and i want to do something more ellegant than this, so that if one of the OS's changes my script doesn't need to be modified. Thanks Mbond
Back to
Seekers of Perl Wisdom
|
|