Under Windows, this cannot happen. The rename will fail if the target file exists.It can happen. Use the Windows MOVE command instead of RENAME:
C:\Projects_Perl\testing>rename newfile.txt originalfile.txt
A duplicate file name exists, or the file cannot be found.
Or use Perl:MOVE /Y newfile.txt originalfile.txt
perl -e "rename('newfile.txt', 'originalfile.txt')"
In reply to Re^6: Read in hostfile, modify, output
by eyepopslikeamosquito
in thread Read in hostfile, modify, output
by razmeth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |