in reply to Moving directories on Win32

This works just fine for me:
use File::Copy qw(move); use strict; move("C:/foo/bar/my_work/whatever", "C:/foo/bar/whatever") or die "Can +'t move: $!";
What is your error message?

- Miller

Replies are listed 'Best First'.
Re^2: Moving directories on Win32
by aplonis (Pilgrim) on Nov 28, 2007 at 18:34 UTC

    The error message is..."Permission denied"...even though the move is going up one directory to my own desktop.

    I can manually make that same move, no problem. The script can mkdir to there, write a *.txt to there, just not move a directory there.

      Whenever you use a OS call and check for failure it is as well to display $^E as well (or instead of) $!. In this case, you would get the following:

      warn $!; Permission denied warn $^E The process cannot access the file because it is being used by another + process

      Which makes identifying the problem easier, if not the solution.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
      Well, if you can mkdir the directory that you're trying to move to then I'm guessing you're most likely dealing with a locking issue for your source directory. Do you have window opened to that directory, or even a text editor with that directory as the last opened location?

      Try closing all extra programs and rerun the script. From outside the source directory of course. :)

      If all else fails, you could play around with File::Find to create your own 1 to 1 recursive move function. It would also probably fail at some point, but you would find the exact file or directory that is being locked that way.

      - Miller