51

Windows 7 Ultimate 64bit:

I'm looking for a way to find all the files in a directory that are NOT of a specific file type or extension.

Example: I'd like to find every file that isn't an .mp3 in my music folder (and all sub folders).

Jeff
  • 675
  • 1
  • 6
  • 6

7 Answers7

81

type this in the search box of the directory you want to search

NOT *.mp3
Terry
  • 1,649
  • 3
  • 19
  • 24
  • How to make this work in windows XP? – Pacerier Aug 27 '14 at 13:14
  • 6
    This was new to me, but brilliant! After testing it, I want to add you can do multiples, such as NOT *.mp3, NOT *.aiff, etc. You can even do "NOT folder" to exclude folders. – Jeff Jul 17 '15 at 20:01
  • But how to add several NOT conditions to a file type:folder search? Question here: http://superuser.com/questions/1001163/windows-7-search-multiple-condition-find-folders-of-this-size-that-does-not-co – JinSnow Nov 16 '15 at 07:30
  • 2
    Old thread, but there was a question to be answered. @Guillaume You can chain AND NOT after your initial arguments. – avluis Feb 27 '17 at 08:32
  • Can you do this for multiple extensions? Something like NOT (*.mp3 AND *.wav) – Cornelius Jan 11 '22 at 07:36
  • If you are wondering why its not working for you, mind you operators like NOT, OR etc are case sensitive. For a file system that is case insensitive! Also these patterns work only in file explorer, they don't work in .NET APIs like `EnumerateFiles` – nawfal Jul 24 '23 at 06:36
7

From a command prompt you can pipe the direcotry list into findstr, and use findstr's V switch to exclude lines like the filter (in this case, lines ending in .mp3), as well as the I switch to make the find procedure case-insensitive.

dir | findstr /vi "*.mp3"
Ƭᴇcʜιᴇ007
  • 111,883
  • 19
  • 201
  • 268
2

I just open the folder with Windows Explorer, add the Type column to the display, and sort on it.

Daniel R Hicks
  • 6,143
  • 3
  • 27
  • 50
0

Step 1: Get FindUtils.
Step 2: find some\dir -type f ! -name *.mp3

Ignacio Vazquez-Abrams
  • 111,361
  • 10
  • 201
  • 247
0

You could try

xcopy /L /EXCLUDE:.mp3 /S DIRNAME .

The /L flag forces xcopy to only list but not copy the /s runs through all subfolders and the exclude misses out mp3s

Col
  • 7,037
  • 21
  • 21
0

For a quick look I sort by clicking on the type column header in Explorer. There is a pull down option to tick boxes for only the files you want listed.

BrianA
  • 1,582
  • 12
  • 12
0

You can check a mime-type with:

file -i <YourFile> -F "::" | sed 's/.*:: //' | sed 's/;.*//'

and then write a script.

Adobe
  • 2,649
  • 2
  • 28
  • 34