by EvilTerran · 10y ago · 0 comments
Hello!
perl -MFile::Find -e 'find sub{if(-f&&/^whatever/){say$File::Find::name;unlink}},"."'
You might even be able to do 'find{...}"."' (no "sub" or ","), but I don't have perl on my phone to test that ;) perl -E 'sub x{say;for(<$_/*>){&x;unlink}};x for@ARGV' *
perl -E 'push@ARGV,<$_/*>for@ARGV;say,unlink for@ARGV' *Also, I think yours would go into an infinite spin if it met a symlink loop (say, "ln -s . foo") - File::Find is hardened against that kinda shenanigans.
perl -E 'for(@ARGV){say,unlink for<$_/whatever*>;push@ARGV,($_)x(-d^-l)for<$_/*>}' .