use File::Copy; $dir="/tmp/test2/magic/"; opendir(DIR, $dir) or die "can't opendir $dir: $! \n"; @files=readdir(DIR); closedir DIR; # Get currect date/time my @date = (localtime)[5,4,3,2,1,0]; $date[0] +=1900; ++$date[1]; $date_string = sprintf('%04d%02d%02d',@date[0,1,2]); foreach $file (@files) { if (-f "$dir$file") { $moveloc="/tmp/test2/magic/backup/$file.$date_string"; $old = "$dir$file $new = "$moveloc"; copy($old, $new) or die "Copy Faild: $!"; #### ./testrenp11122010b ./testrenp11122010b: use: not found. ./testrenp11122010b[3]: =/tmp/test2/magic/: not found. ./testrenp11122010b[4]: 0403-057 Syntax error at line 4 : `(' is not expected.