in reply to Renaming a group of files occassionally deletes some
Could it essentially be going too fast and renaming some to "" which causes Windows to delete them? I figured an error would appear somewhere if it failed to rename something.
from perldoc -f rename:
rename OLDNAME,NEWNAME Changes the name of a file; an existing file NEWNAME will be clobbered. Returns true for success, false otherwise.
C:\temp>touch foo1.txt C:\temp>touch foo2.txt C:\temp>dir foo?.txt Il volume nell'unità C non ha etichetta. Numero di serie del volume: 0464-729A Directory di C:\temp 01/06/2007 19.36 0 foo1.txt 01/06/2007 19.37 0 foo2.txt 2 File 0 byte 0 Directory 4.888.121.344 byte disponibili C:\temp>perl -e "rename 'foo1.txt', 'foo2.txt'" C:\temp>dir foo?.txt Il volume nell'unità C non ha etichetta. Numero di serie del volume: 0464-729A Directory di C:\temp 01/06/2007 19.36 0 foo2.txt 1 File 0 byte 0 Directory 4.808.515.584 byte disponibili
Use e.g. -f to check for the existence of the destination before possibly clobbering it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Renaming a group of files occassionally deletes some
by coldfingertips (Pilgrim) on Jun 01, 2007 at 18:51 UTC | |
by Util (Priest) on Jun 01, 2007 at 21:05 UTC |