$ perldoc -q rename Found in /usr/lib/perl5/5.6.1/pod/perlfaq5.pod How can I reliably rename a file? Well, usually you just use Perl's rename() function. That may not work everywhere, though, particularly when renam ing files across file systems. Some sub-Unix systems have broken ports that corrupt the semantics of rename()--for example, WinNT does this right, but Win95 and Win98 are broken. (The last two parts are not surprising, but the first is. :-) If your operating system supports a proper mv(1) program or its moral equivalent, this works: rename($old, $new) or system("mv", $old, $new); It may be more compelling to use the File::Copy module instead. You just copy to the new file to the new name (checking return values), then delete the old one. This isn't really the same semantically as a real rename(), though, which preserves metainformation like permissions, timestamps, inode info, etc. Newer versions of File::Copy exports a move() function.
In reply to Re: Rename a file
by DamnDirtyApe
in thread Rename a file
by kidd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |