perlNinny has asked for the wisdom of the Perl Monks concerning the following question:
I have had no luck trying to ever just get the directory size, let alone move files and directories with files. Here is my unsucessful code:
indir= M:AllFiles, outdir=n:llFiles
indir size=0 outdir size=0
indir= M:AllFiles, outdir=n:llFiles
indir size=0 outdir size=0
indir= M:AllFiles*, outdir=n:llFiles
indir size=0 outdir size=0
So, what am I doing wrong?
The results are three beeps plus this output:use strict; use File::Copy; # yes, it is Windows XP and a drive letters assigned to a USB and a NA +S drive. # Indir and outdir will be a parameter in this format. my $inDir = "M:\AllFiles"; my $outDir = "n:\allFiles"; # test 1 straight in out in DOS format. MoveFiles($inDir,$outDir); # test 2 Try within quotes. MoveFiles("$inDir","$outDir"); # test 3 Try selecting ALL files in the directory MoveFiles($inDir."\*", $outDir); sub MoveFiles { my ( $source, $destination ) = @_; print "indir= $source, outdir=$destination\n"; my $source_size = (-s "$source") || 0; my $destination_size = (-s $destination) || 0; print "indir size=$source_size outdir size=$destination_size\n"; }
indir= M:AllFiles, outdir=n:llFiles
indir size=0 outdir size=0
indir= M:AllFiles, outdir=n:llFiles
indir size=0 outdir size=0
indir= M:AllFiles*, outdir=n:llFiles
indir size=0 outdir size=0
So, what am I doing wrong?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Moving files and directories
by Nkuvu (Priest) on May 09, 2009 at 00:00 UTC | |
by perlNinny (Beadle) on May 09, 2009 at 00:12 UTC | |
by ig (Vicar) on May 09, 2009 at 07:19 UTC | |
by Anonymous Monk on May 09, 2009 at 08:33 UTC | |
by Anonymous Monk on Mar 15, 2012 at 17:28 UTC | |
Re: Moving files and directories
by bichonfrise74 (Vicar) on May 09, 2009 at 00:03 UTC | |
by perlNinny (Beadle) on May 09, 2009 at 00:28 UTC | |
Re: Moving files and directories
by Marshall (Canon) on May 09, 2009 at 01:52 UTC | |
by perlNinny (Beadle) on May 09, 2009 at 20:30 UTC | |
by Marshall (Canon) on May 11, 2009 at 08:52 UTC | |
Re: Moving files and directories
by afoken (Chancellor) on May 09, 2009 at 00:59 UTC | |
by perlNinny (Beadle) on May 09, 2009 at 01:18 UTC | |
by afoken (Chancellor) on May 09, 2009 at 01:58 UTC |
Back to
Seekers of Perl Wisdom