return if $File::Find::dir ne $root_dir;
You're traversing an entire tree even though you ignore all results from subdirectories. Very wasteful! I think the solution is:
sub wanted { my ($file)=$_; if (-d $file) { $File::Find::prune = 1; return; } my $dir_to_make = categorize($file); File::Path::make_path($dir_to_make); File::Copy::move($file, $dir_to_make); }
Error checking would be useful.
In reply to Re: move files to directories based on criteria
by ikegami
in thread move files to directories based on criteria
by metaperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |