rename

Synopsis

$ rename("old", "new")

Rename the specified file.

Parameters

"old" - the old file to rename.

"new" - the new file name.

Returns

The new path if the operation was successful or $null.

Side Effects / Notes

Examples

# how to use Sleep to rename thousands of files $newprefix = "olddata"; $oldprefix = "dota"; sub checkFile { if (-isDir $1) { map(&checkFile, ls($1)); } else if ("$oldprefix $+ *.html" iswm $1) { rename($1, strrep($1, $oldprefix, $newprefix)); } } checkFile("c:/");

See Also