Hey Brett,

Wednesday, June 20, 2001, 8:38:34 AM, you wrote:

>> Is there a Perl way to move a folder with out doing it one file at
>> a time? (Similar to M$ Windows Explorer where you can drag a folder
>> to another folder?)

BWM> Of course -- take a look at the File::Copy module. It has a move
BWM> function in it.

Isn't File::Copy for Files? I need to move Directories. For example a
WinNT directory that has been copied to a network drive for backup.

Here is my code for testing File::Copy (both the move and copy).  Am I
doing something wrong?

#!perl -w
use strict;
use diagnostics;
use File::Copy;

my $Drv = "D:";
my $SourceFolder = "!Source";
my $DestFolder =   "!Dest";
my $TestFolder = "test";
my $Source = "$Drv/$SourceFolder/$TestFolder";
my $Dest = "$Drv/$DestFolder/$TestFolder";
#my $Dest = "$Drv/$DestFolder";

# Set up the test folders
if (!-d $Dest) { mkdir($Dest); } # Create the Destination dir
if (!-d "$Drv/$Source") { # Create the Source dirs
  mkdir("$Drv/$SourceFolder");
  if (!-d $Source) { mkdir($Source); }
}

# =========== The Test Code ============
if ( -d $Source ) {
    print "\nSource\t$Source\n";
print "Dest\t$Dest\n";
    move ($Source, $Dest) or die "Error: $!\n";
    if ( -d "$Dest/$TestFolder" ) {
        print "Dest\t$Dest\n";
    }
}

-- 
[EMAIL PROTECTED]
Using The Bat! eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
Life would be easier if I had the source code.

Reply via email to