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

I am running triggers on my server that are set off when certain text files are FTP'd to a default directory I have set up. What I want to be able to do is move these files to another directory after the trigger has fired. Here is a workflow: 1.) Text file(mlb_boxscore12.txt) is FTP'd to the D drive on my server. 2.) At 4:00 p.m., I have a trigger set up that runs for this file and outputs it to a web site. After it is outputted to the web site I have no use for it in this directory. I would really like it moved to another folder on a seperate drive. What would be the best way of doing this?

Replies are listed 'Best First'.
Re: Moving a Text File
by arturo (Vicar) on May 15, 2001 at 02:24 UTC

    The most portable solution is a combination of File::Copy and unlink (yes, not delete!). You could try it with rename on its lonesome, but that can behave differently on different systems.

    perl -e 'print "How sweet does a rose smell? "; chomp $n = <STDIN>; $r +ose = "smells sweet to degree $n"; *other_name = *rose; print "$other +_name\n"'
(ar0n) Re: Moving a Text File
by ar0n (Priest) on May 15, 2001 at 02:34 UTC