J
Jon Ripley
I while back I wrote a perl script which recursed through a directory
structure and tidied up any non-preferred file names. It used the standard
rename (oldfile, newfile); approach and I discovered, to my horror, some
very unexpected behaviour when it was run on an operating system with a case
insensitive filing system.
Where filename 'aaa_bbb.ccc.ccc' would be correctly renamed to 'Aaa Bcc.ccc'
on all systems. For cases where only the case of a filename changed - as in
'Aaa bbb.ccc' becoming 'Aaa Bbb.ccc', perl sucessfully deleted all the
files.
It seems that perl was doing:
copy oldfile newfile
delete oldfile
which on a case-insensitive filesystem has the effect of simply deleting
oldfile.
Is this, as it seems to be, standard perl behaviour or is it possible that
it is a piece of very sloppy programming in the particular port I am using?
If copy/delete is standard then there is a *major* data loss causing bug in
perl which needs to be resolved.
(Currently I am manually doing rename old TMP; rename TMP new which is just
a hacky workaround.)
Jon Ripley
structure and tidied up any non-preferred file names. It used the standard
rename (oldfile, newfile); approach and I discovered, to my horror, some
very unexpected behaviour when it was run on an operating system with a case
insensitive filing system.
Where filename 'aaa_bbb.ccc.ccc' would be correctly renamed to 'Aaa Bcc.ccc'
on all systems. For cases where only the case of a filename changed - as in
'Aaa bbb.ccc' becoming 'Aaa Bbb.ccc', perl sucessfully deleted all the
files.
It seems that perl was doing:
copy oldfile newfile
delete oldfile
which on a case-insensitive filesystem has the effect of simply deleting
oldfile.
Is this, as it seems to be, standard perl behaviour or is it possible that
it is a piece of very sloppy programming in the particular port I am using?
If copy/delete is standard then there is a *major* data loss causing bug in
perl which needs to be resolved.
(Currently I am manually doing rename old TMP; rename TMP new which is just
a hacky workaround.)
Jon Ripley