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

Ok, I just joined today and I am hoping for some great one's to loan me thier infinate wisdom. My work have a new FTP server (running Red Hat Linux 7.0) and they also have a Windows 2k server. They want a script that will transfer files from the FTP server to the Windows box every hour, but also on demand. I would like to know if there is a script out there that I can modify without too much work becuase I haven't touched pearl before. What I need the script to do is to search the FTP server for new files and transfer them over without delete the other files on the Wondows box. I then need the files deleted off of the FTP server. Now, the Windows box can do NFS shares (create them so that people can mount them). My boss doesn't want the share mounted all of the time, so it would have to mount it, transfer the files, then unmount it. Can anyone help me on this?

Replies are listed 'Best First'.
Re: Creating a script
by dragonchild (Archbishop) on Oct 10, 2001 at 23:56 UTC
    Why would you need to mount anything?? Why not just use Net::FTP and have it make the FTP connection from the Linux box to the Win2k box and transfer them. The script would look something like:
    use Net::FTP; # Put approrpriate parameters in here my $ftp_conn = Net::FTP->new(...); opendir DIR, "/Some/Dir/With/Files" || die "Cannot open directory: $!\n"; my @filenames = grep !/^\.\.?$/, readdir DIR; closedir DIR; foreach my $file (@filenames) { $ftp_conn->put($file); } $ftp_conn->close;

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Re: Creating a script
by trantor (Chaplain) on Oct 11, 2001 at 10:17 UTC

    Warning: not a Perl solution ahead.

    It looks like you're trying to duplicate what rsync and Unison (among others) do. Of course they run on both Win32 and UNIX platforms and can save you lots of time and pain.

    -- TMTOWTDI