Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: mkdir in loop - overwrite danger?

by graff (Chancellor)
on Dec 22, 2015 at 23:09 UTC ( [id://1150985]=note: print w/replies, xml ) Need Help??


in reply to mkdir in loop - overwrite danger?

Rest assured that all implementations of creating a directory share the property that if the directory already exists, nothing happens to it or its contents. (Different implementations might have different kinds of "failure" behaviors when this condition comes up, but they'll all leave an existing directory as-is.)

Now, if a directory contains a data file with a particular name, and you mistakenly do something that involves overwriting or replacing the contents of the file with something you don't really want -- e.g. rename($badfile,$goodfile); -- the damage will "succeed", of course.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-19 08:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found