Working Through File Command?

John Heim jheim at
Tue Mar 4 15:14:42 UTC 2008

I'm not sure I understand your request. Are you saying you want to use the 
file command to identify files of a certain type and delete only those 
files? You probably can do anything you like via a combination of the find, 
file, grep, and xaarg commands.

The following line will delete all PDF documents in a directory tree (except 
for ones with a space in the name).

find . -exec file {} \; | grep 'PDF document' | cut -d':' -f1 | xargs rm -f

You'd want to replace the string "PDF document" with whatever string file 
uses to describe your documents.

----- Original Message ----- 
From: "Hart Larry" <chime at>
To: "Blinux Discussion List" <blinux-list at>
Sent: Friday, February 29, 2008 7:07 PM
Subject: Working Through File Command?

> Hi All:  This was certainly a hard subject-line to ask about?
> I wonder if I can search for or delete files in a directory based on what 
> "file" reports?  You see, I am still trying to enjoy Mutella, a file 
> sharing program.  However, now much of the time my searches are 
> hijacked--and while the files may actually have an mp3 extention, they are 
> apple or isa media, according to file.  Sure I can nuke them from the 
> directory, but if there were a way to enter a system command in Mutella or 
> in my searches to ignore these other file types.  Especially last 2-weeks 
> its gotten so bad I closed out Mutella, but I really would like a better 
> solution.  I have a quite large list of exception words in all my 
> searches, but I figure I could have more accurate results if I can use the 
> file command.
> Any suggestions please.  In linux, other than Mutella, I had run overnet. 
> Thanks in advance
> Hart
> _______________________________________________
> Blinux-list mailing list
> Blinux-list at

More information about the Blinux-list mailing list