in reply to moving multiple files

#!/usr/bin/perl -w use strict; use warnings; use File::Copy; my $olddir= "./Old"; my $newdir="./New"; opendir DH, $olddir; while(my $file = readdir DH) { move "$olddir/$file" , "$newdir/$file"; } closedir DH;

Replies are listed 'Best First'.
Re^2: moving multiple files
by blazar (Canon) on Jan 17, 2006 at 08:01 UTC
    blazar@q ~/test $ mkdir Old blazar@q ~/test $ touch Old/foo blazar@q ~/test $ touch Old/bar blazar@q ~/test $ ./spiritway.pl blazar@q ~/test $ ls -R .: Old spiritway.pl ./Old: bar foo blazar@q ~/test $ mkdir New blazar@q ~/test $ ./spiritway.pl './Old/..' and './New/..' are identical (not copied) at ./spiritway.pl + line 11 blazar@q ~/test $ ls -R .: New Old spiritway.pl ./New: ./Old: bar foo