in reply to Mass file renaming

I'm sure that you closed the file before you tried to rename it, because Windows gets cranky when one tries to rename or delete an open file.

You did close it before renaming, didn't you?

emc

Replies are listed 'Best First'.
Re^2: Mass file renaming
by Anonymous Monk on Nov 07, 2005 at 15:29 UTC
    Hi,

    The file is closed, but the routine is still within a:

    foreach(@files); loop

    I don't know if this implements a lock of the files in the dir? If so, is it escapable?

    thanks for your contribution.

      It may have if you got @files by something like:

      opendir($dh, "$working_directory" @files = grep { /\.csv$/i } readdir($dh)

      and didn't close the directory. I know rmdir doesn't work on Windows if the directory being deleted is open somewhere; Windows may prevent writing the directory if it's still "open" by opendir.

      On the other hand...if you got the names by some other means, I'll admit being stumped.

      emc