Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Deleting a File in Windows

by roboticus (Chancellor)
on May 05, 2009 at 16:55 UTC ( #761982=note: print w/replies, xml ) Need Help??

in reply to Deleting a File in Windows


Another possibility: If another job has the file open, then the delete won't work. In my environment (running cygwin under Windows XP), I see this all the time. IIRC, cygwin has a background thread, so if you remove the file, it will actually be deleted after the other processes release the file.

As an illustration, create a simple text file called zanzibar.txt, and run the following program in a window.

#!/usr/bin/perl open INF, '<', 'zanzibar.txt' or die $!; sleep 300; close INF or die $!;

Then, in another window, delete the file. On my system, I see this:

roboticus@swill$ ls zanzibar.txt roboticus@swill$ rm zanzibar.txt roboticus@swill$ ls zanzibar.txt

If I wait five minutes and look again, it's gone:

roboticus@swill$ ls roboticus@swill$

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://761982]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-01-19 10:34 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (55 votes). Check out past polls.