in reply to How to conditionally terminate finddepth?
Use a global flag to say you are done:
use strict; use warnings; use File::Find; my $base = '/my/working/directory'; my $done = 0; finddepth(\&no_old_dir_please, $base); sub no_old_dir_please { $done ||= (-M $_) <= 30; $File::Find::prune = $done; }
Update: Read the docs before replying next time :)
Note, not tested
|
|---|