Errr, I don't think you can move a file by "renaming", not on a Windoze box
anyway, and your use of a path like D:\ftproot implies Windoze to me. Maybe
I'm wrong, but these are my thoughts - untested.


----- Original Message -----
From: "Carl Jolley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, September 12, 2002 10:06 AM
Subject: Re: DESPERATE


> On Tue, 10 Sep 2002 [EMAIL PROTECTED] wrote:
>
> >
> > I'm really desperate here.
> > I have a list of files in:
> > D:\ftproot\edi\inbox\
> >
> > I want to move these files to :
> > D:\ftproot\edi\tmp\
> > before I can start processing.
> >
> >
> > So I am using the code below but it doesn't work.
> > I know I'm not eligible, but will you please help.
> >
> >
> > opendir(INVOICES,'D:\ftproot\edi\test') || die "cannot open invoice:
$!";
> >
> > while ($invoice = readdir(INVOICES))
> >      {($invoice
> >
rename('D:\ftproot\edi\test\$invoice','D:\ftproot\edi\tmp\$invoice');
> >      }
> > closedir(INVOICES) || die "can't close  INVOICES: $!";
> >
>
> You probably only want to move the files so you need to avoid
> trying your rename unless the item is a file. Note, all directories
> will contain directories, at a minimun, . and ..
> Also your $invoice variable will not be interpolated if it is
> inside single quotes, but then your backslashes will cause problems, so:
>
> while ($invoice = readdir(INVOICES))
>    next unless -f "D:/ftproot/edt/test/$invoice";
>    rename("D:/ftproot/edi/test/$invoice",'D:/ftproot/edi/tmp/$invoice");
> }
>
>
> **** [EMAIL PROTECTED] <Carl Jolley>
> **** All opinions are my own and not necessarily those of my employer ****
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to