At 03:08 PM 4/18/2001, you wrote:

>I wrote this code to email me attachments of any files found at a certain
>ftp site.  It works but... since I'm new at Perl I know there's got to be a
>better way.  In particular the handling the file transfer by parsing out the
>output from DIR seems hinky.  Let me know if you can help.

Check out my other note about grepping dirs on Win32.  The same would apply.
Using File::Find is good if you want all the files from a tree, but if you 
just want to read a single dir, and not all of the dirs below it, use 
opendir and readdir.  Check out perlop for more info.

Here's all you have to do to read all of the contents of a single dir.

opendir MYDIR, "c:/dir/i/want/to/read";
print "$_\n" foreach readdir MYDIR;

You can use Perl's -X operators (also in perlop) to figure out if something 
is a directory or what.

And, I know you didn't ask for a pointer on this, but you might want to use 
Net::SMTP to send your mail, as opposed to Blat, but that's just me.  : )

Thank you for your time,

Sean.

Reply via email to