in reply to I cannot create backup copy during file name change
There is no need to make a back-up of a file before you rename it ("move" it to another directory). There are differences between copy and mv but basically it will work or it will not. If not, the original file is left intact.#!/usr/bin/perl -w use strict; my $newdir ="something"; foreach my $file (glob "*.txt") { rename $file, "$newdir/$file" or warn "rename $file to $newfile failed: $!\n"; } # $file will still exist if rename fails
|
|---|