For a start change the name of your rename sub so it doesn't clash with Perl's rename function. Then you may be able to use rename $file $dir/$filename rather than `mv $file $dir/$filename` (perhaps depending on the OS you are using) to "rename" the file to a different directory. It's probably important that the target directory exist and be on the same drive.
There may be other minor speed ups, but if the rename does the trick it will be the largest impovement you can make by a long way.
In reply to Re: performance problems with renaming multiple files using another file name
by GrandFather
in thread performance problems with renaming multiple files using another file name
by mav3067
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |