Perl Monk, Perl Meditation | |
PerlMonks |
Recursing subdirectories for contraband...by Necos (Friar) |
on Jun 10, 2002 at 18:19 UTC ( [id://173246]=perlquestion: print w/replies, xml ) | Need Help?? |
Necos has asked for the wisdom of the Perl Monks concerning the following question:
Now, I know this question is kind of taken care of in the Q&A section (which is where I got the idea). However, I wanted to take the recursive listing of directories a little further, and look at using opendir, readdir, and for / map to find and delete contraband (e.g., .mp3 and .exe). Of course, we all know that filename extensions can be changed, but that's not important as getting the basics down (for example, checking the last 128 bytes in a file for ID3 tags can help to identify an mp3). Here is my codebase (which needs some advising): The only problem with this code, is that it only seems to work on some directories and not others... Any further guidance is appreciated. Theodore Charles III Network Administrator Los Angeles Senior High 4650 W. Olympic Blvd. Los Angeles, CA 90019 323-937-3210 ext. 224 email->secon_kun@hotmail.com perl -e "map{print++$_}split//,Mdbnr;"
Back to
Seekers of Perl Wisdom
|
|