Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: move files to directories based on criteria

by ikegami (Pope)
on Jul 10, 2009 at 19:05 UTC ( #779011=note: print w/replies, xml ) Need Help??


in reply to move files to directories based on criteria

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://779011]
help
Chatterbox?
[Corion]: I see a download link there?
[Corion]: (at least the curl stuff is in a download link)
[Corion]: Also, I think the OPs problem is on their intranet and not on the internet (also, they should likely use WWW::Mechanize instead, which knows about cookie)
[1nickt]: yes, could be.
[1nickt]: I don;t see the link , definitely, after reloading the node
[1nickt]: Is it possible to disable it?
[Discipulus]: if you mean [download] after the code it is there 1nickt
[1nickt]: yes, Corion sees it too, and I see it when not logged in.
[Corion]: I think you can disable download links in your settings?
[1nickt]: Looking in settings to see if I disabled it in my profile ...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2017-05-23 18:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?