How Do I Find And Delete Files Of A Certain Type?

Dear Lifehacker,A program created data files for every song in my collection. No problem, right? Except my music is spread across nested folders on multiple drives. Know a program that bulk-deletes certain file types? Sincerely, ScatteredTunes

Dear ScatteredTunes,

Depending on which system you're using, it's either a few clicks, a (very) small software download, or a tiny bit of command line jujitsu to chop out a certain perfunctory file type across all your storage.

If you're using Windows XP, you could, theoretically, use the built-in search function—you know, the one with the adorable, yippy dog!—and ask it to look for your file type across all your Windows-recognised storage. If your music-profile app left behind files like Mr_Roboto.PITA (PITA being short for, of course, Pain in the Ashtabula), you'd choose to search "All files and folders," and look for *.PITA.

But the built-in search takes quite some time, and you're better off using a quick search tool. One of our favorites? Everything. As pictured at right, you'd load either its installed or portable version on your system, search for *.PITA, and when it's done its job in just a few seconds, hit Ctrl-A to select everything, right-click on the selected files, then hit delete to finish them off.

Windows Vista (and XP with the optional Windows Search 4.0 installed) offer a bit more built-in power. Hit the search option from the Start menu, toggle the Advanced Search option from the right-hand corner, and use the drop-down fields to narrow your search:

On a Mac, Spotlight has you covered. Gina covered a system-wide search and delete mission in her own Ask Lifehacker response, which also involved a wonky, folder-clogging file (what's up, thumbs.db!).

We're kind of doubtful you're a Linux user stricken with a proprietary, file-dropping program. Still, on the off chance you wanted to kill those files open-source style, crack open the terminal and type in this command:

find ./ -iname *.PITA

See your files there? If not, and you've got them stashed on a NTFS partition you've mounted in Linux, you might have to get specific. In my case, for instance, I'd type:

find /media/win7/ -iname *.PITA

Now, if it looks like everything's been found, and nothing unintentional targeted, add a little bit onto the end:

find ./ -iname *.PITA -exec rm {} ;

Need to get a bit more in-depth and particular? Try this handy guide to the find command.

Peace, soul, and good hunting, Lifehacker


    AgentRansack, when searching for a file , you can search extensions and within folders, i always get rid of pesty Thumbs.db files windows creates by searching for .db files

    Then highlight and delete.

    I always find this useful in a Command window :-

    del /s *.xyz

    which will recursively delete the *.xyz file in current folder and all folders below

    can always be used with the /P flag if you really need to be sure of each file.

    I created a little guide on how to recursively remove hidden files.
    it's pretty simple actually
    del /s /q /ah *.*
    my blog post on it :

    Just an FYI ...

    The ";" needs to be escaped ... "\;"

    find ./ -iname *.PITA -exec rm {} \;

    There're actually quite a lot of good search functions on the computers nowadays to help you scour yoru data storage folders for files you may have accidentally misplaced. But honestly, it's just good practice to be a bit more careful when you're saving files into your harddrive rather than having to search around for them!

Join the discussion!

Trending Stories Right Now