in reply to File::Find and replacing spaces in filenames.

Your logic ends up like this:

  1. Enter directory
  2. Call wanted() sub, which renames the directory
  3. Return from the sub
  4. Get confused, since the directory we're in no longer exists

You can make it work correctly if you only do the renaming after you've finished with the directory's children. File::Find provides the bydepth option to do that. (Or alternatively, the finddepth() subroutine)

Replies are listed 'Best First'.
Re^2: File::Find and replacing spaces in filenames.
by Kyshtynbai (Sexton) on Dec 22, 2012 at 19:59 UTC
    Thank you a lot! I should have read the description of the module more carefuly.
      I should have read the description of the module more carefuly.

      Amen brother, amen!