in reply to Weird rename error

If you call mkpath with a non-zero second parameter like eval { mkpath($dir_path, 1) };, it will "print the name of each directory as it is created" which may help diagnose the problem.


Perl is Huffman encoded by design.

Replies are listed 'Best First'.
Re^2: Weird rename error
by datmrman (Initiate) on Jul 26, 2005 at 20:53 UTC
    I tried that, and it printed out the directories that its suppose to create:
    mkdir S000471M37 mkdir S000471M37/20020206-091042 mkdir S000471M37/20020206-091042/268 could not rename 1.2.124.113532.172.16.48.200.20010514.120225.267932/1 +.2.840.113619.2.80.2162541498.1619.1046210641.2/1.2.840.113619.2.80.2 +162541498.1619.1046210641.3.dcm to S000471M37/20020206-091042/268/S00 +0471M37-20020206-091042-268-1.dcm: Is a directory
    but after the program dies
    ls -R S000471M37/ S000471M37/:
    It only likes to create the first level directory.
      What version of File::Path and File::Copy do you have?
        Thank you all for your input. I have found the source of my headaches.

        I decided to print mkdir and rename commands out to a file and execute the list of commands from that file and noticed something weird.

        The $filename and $dir_path variables contained unreadable characters, which did not print out during the execution of the script, but did print out to a file. Using regular expressions, I was able to remove the unwanted characters.. and so far so good! Everything is being renamed as it should. Thanks again all for your input.