in reply to Re: File::Path problem (will not create file if directory with same name exists)
in thread File::Path problem (will not create file if directory with same name exists)

oh i did not even know you couldnt create a file and directory of the same name in the same directory. seems i have to make a temp folder and then copy the file to the right location. thanks for pointing that out. real noob moment lol
  • Comment on Re^2: File::Path problem (will not create file if directory with same name exists)

Replies are listed 'Best First'.
Re^3: File::Path problem (will not create file if directory with same name exists)
by Monk::Thomas (Friar) on May 19, 2014 at 15:25 UTC

    Hint: Create a file with a temporary filename in the correct location, write the file's content and attributes and if everything went well rename it into the correct filename. If something fails delete the file.

    Of course you can create the tempfile somewhere else, but then the copy operation may fail (not enough diskspace? insufficent permissions?) which could leave you with an incomplete/invalid file. Reducing the 'critical' operation to a rename drastically reduces the chances of something going wrong.