Forum Moderators: bakedjake
I am monitering a server that many others can upload to. We have "rules" about no multimedia files, but those rules are generally ignored. I ran several find commands to locate multimedia files like this:
find / -name \*.mp3\* -print
find / -name \*.MP3\* -print
What I really want to do is find these files, but not search all directories (for example, I don't want to search our usr/ports directory). I also would like the full path and file name, plus the offending file's size. Is there a way to do this?
Thanks, Jenny
I'm assuming you're using FreeBSD (from the /usr/ports reference), or another *BSD.
The easiest way to do a search like that would be something like:
find /path/to/upload/areas -iname *.mp3 I'm going to assume that your users don't have write access to /usr/ports, so you can probably limit your search to /home, /tmp and /var/tmp (You may need to change /home to /usr/home):
find /home /tmp /var/tmp -iname *.mp3 The -iname tells it to do a case insensitive search (Mp3 is the same as mp3).
To get the additional information you also want, you could do:
find /home /tmp /var/tmp -iname *.mp3 -exec ls -l {} \; That will give you a long listing of the file. The output would be similar to:
-rw-r--r-- 1 user group 0 Jul 25 13:20 /tmp/test.mp3
I hope that helps!
MM