in reply to Moving folders

Using system, this is how you can do it on Windows:
$defaultdir = 'C:\Foo\'; # Directory containing original folders $destinationdir = 'C:\Bar\'; # Directory to copy folders to system "move /y $defaultdir/$matchedfolder $destinationdir";
You could place this within a loop that reads each line and places the matched folder name in $matchedfolder. The /y just keeps a overwrite confirmation box from popping up. If you would like to be warned before overwriting files remove /y.

I don't see any reason you couldn't run this from your XP computer and move files on your NT server. Just map the directories you are working with and use M:/ or whatever drive letter you designate in the path variables.

Replies are listed 'Best First'.
Re^2: Moving folders
by bobdole (Beadle) on Mar 10, 2005 at 00:28 UTC
    As I said I am pretty new at this so I am sure I am missing something but i tried this code just to test it out
    #!/usr/bin/perl

    $defaultdir = 'C:\Documents and Settings\Tim\My Documents\test1'; # Directory containing original folders
    $destinationdir = 'C:\Documents and Settings\Tim\My Documents\test2'; # Directory to copy folders to
    $matchedfolder ='foo'; # a folder name in test1

    system "move /y $defaultdir/$matchedfolder $destinationdir";

    i run it and i get the msg
    "The syntax of the command is incorrect"

      Here we're dealing with two programs: perl and move. Actually, on Windows, I think move is merely part of CMD.EXE. You need to format your input into move from perl such that move (or CMD.EXE) understands it. And it doesn't get spaces properly.

      system qq(move /y "$defaultdir/$matchedfolder" "$destinationdir");

      Perl makes this so much easier than doing the same thing in other languages, such as C or Java. SOOOO much easier with that qq operator.

        That was it. Thanks alot!