in reply to Re^4: Rename unreliable on Windows
in thread Rename unreliable on Windows
is there an easy workaround (apart from disabling the backup sw)?
You could just keep trying to rename it...
1 until rename $file1, $file2;
Of course, if a file can genuinely never be renamed, this will cause your script to keep trying forever. Better to limit to a finite number of attempts at renaming.
my $attempts; while (not rename $file1, $file2) { $attempts++; die "Could not rename file: $!" if $attempts > 7; sleep $attempts; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Rename unreliable on Windows
by MidLifeXis (Monsignor) on Apr 04, 2012 at 12:48 UTC | |
|
Re^6: Rename unreliable on Windows
by elef (Friar) on Apr 04, 2012 at 16:22 UTC |