Do you have the file open?

You cannot delete an open file according to Bill.

open (JUNK, '>junkyfile.txt');
print JUNK "STUFF IN junkyfile.txt\n";
close JUNK;
print `type junkyfile.txt`;
unlink 'junkyfile.txt';
print `type junkyfile.txt`;

... prints...

STUFF IN junkyfile.txt
The system cannot find the file specified.

... or ...

STUFF IN junkyfile.txt
STUFF IN junkyfile.txt

... depending on whether the close is there or not.

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Edward G. Orton
> Sent: Wednesday, November 28, 2001 3:04 PM
> To: Perl-Win32-Users Mailing List
> Subject: unlink(file)
> 
> 
> I seem to have a problem with deleting files from Perl. I use
> unlink('filename') to delete the file, but it does not actually
> get deleted until the perl program exits. This is a problem
> since I am using a perl program to clean up old files, and put
> new ones on a removeable drive. If the drive is full, I remove
> the oldest files until there is enough data deleted to add in
> the new files. The problem is, until the script exits, the
> deleted files aren't deleted.
> 
> Any suggestions?
> ActivePerl 628 on Windows 2000 server.
> 
> ego
> Edward G. Orton, GWN Consultants Inc.
> Phone: 613-764-3186, Fax: 613-764-1721
> email: [EMAIL PROTECTED]
> 
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
> 
> 

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to