heezy has asked for the wisdom of the Perl Monks concerning the following question:
Hi people,
I have a CGI script that uploads files, performs a bundle of checks upon then and then if they are valid I want to move all files in that directory into a processing directory where a cron job operates on them once a day
(I have uploaded a bundle of files in a tar file and unziped them using Archive::Tar into this directory)
The uploaded files look like..
[277] mf139823@esweb: pwd /apps/webroot/service/servicelist-automation/sl-submission/submitted-f +iles/2002-10-28-11-42-09-ss-mrf2 [278] mf139823@esweb: ls -l total 66 -rwxrwxrwx 1 nobody nobody 17408 Oct 28 11:42 siteresse-sg-eng +.tar -rwxrwxrwx 1 nobody nobody 7361 Oct 22 09:49 siteressse-sg-en +g-20020510.sxw -rwxrwxrwx 1 nobody nobody 7357 Oct 22 09:49 siteressse-sg-en +g-20020918.sxw
...now the code I have to move them looks like this...
sub moveTarFilesToProcessDir{ # $fileFrom = "$curSubmitDir/siteressse-sg-eng-20020918.sxw"; $fileFrom = "$curSubmitDir/*"; $fileTo = "$thisFilesDir/new-files/$user_LOB/"; print $cgi->p("Moving files from <h4>($fileFrom)</h4> to <h4>($fil +eTo)</h4>"); move($fileFrom, $fileTo) or die "($!)"; }
... you'll noitice that one line is commented out. If I use this line instead of the line under it as the $fileFrom variable it will move just that file to the correct place(thats one of the files I'm testing it with)
But I want to move all files in this directory. So why does $fileFrom = "$curSubmitDir/*"; not work? How can I move all of the files in this directory.
At the moment I get the error..
(No such file or directory)
... when I try to use $curSubmitDir/*
Is this a stupid mistake that has kept me puzzled for a the last 3hours or is it not possible with File::Copy?
Thanks everyone,
M
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Move multiple files?
by nothingmuch (Priest) on Oct 28, 2002 at 19:17 UTC | |
by kelan (Deacon) on Oct 28, 2002 at 21:48 UTC | |
|
Re: Move multiple files?
by Kanji (Parson) on Oct 28, 2002 at 19:17 UTC | |
|
Re: Move multiple files?
by joe++ (Friar) on Oct 28, 2002 at 19:14 UTC |