jlarson has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl script that I use to parse attachments from an email using MIME::Parser. That section of my code works fine. Then I use NET::FTP and ftp the attachment to a ftp server. That part works fine to. The problem is that script needs to not overwrite the file on the ftp server if an attachment has the same name as one thats already been ftp'd to that ftp server. I can get the file names on the server side into an array, but I get stuck at that point. How do i pass the array back so I can change the name on the client side before I send them. A counter will not work becuase the script exits. What is the best way to do something like if blah.jpg exists, then the next ftp will be blah1.jpg. If blah.jpg and blah1.jpg exists then the next will be blah2.jpg and so on...some ideas would be very helpful.

Replies are listed 'Best First'.
Re: ftp stuff
by joealba (Hermit) on Aug 14, 2002 at 12:56 UTC