Just another Perl shrine | |
PerlMonks |
Re: Removing all directories recursively except oneby skx (Parson) |
on Aug 06, 2014 at 06:49 UTC ( [id://1096394]=note: print w/replies, xml ) | Need Help?? |
Normally people are pretty good at helping here, if you show what you've done and don't just request that people write code for you, for free. I'd suggest you probably want to start by looking at the File::Find module, as this lets you recurse easily and then take actions on the files. That said if you just want to get the damn thing done why not use the find command? find /glb/home/usjak8/myperl ! -iname 'dir3' -print -delete That will print and delete anything beneath "/glb/home/.." which doesn't have dir3 in the name. If you wished to log just add "| tee ~/delete.log" on the end.
In Section
Seekers of Perl Wisdom
|
|