Command to search multiple file types.
SuperUser contributor AppsDev has the answer for us:
Open Windows Explorer and in the top right search box type *.extension. For example, to search for text files you should type *.txt.
For multiple file types use Ext:.doc OR Ext:.txt OR Ext:.pdf. Hope this helps you.
Special Note: As noted in additional comments in the discussion thread, make sure that the word “OR” is capitalized when doing a search for multiple file types.
Alvaro’s suggestion is good. Standard dir command won’t be able to perform your search as a simple one-liner. You can write a script with three lines:
dir /s \\server_name_and_path\*.jpg > \\path_to_output_file\Report.txt dir /s \\server_name_and_path\*.mp3 >> \\path_to_output_file\Report.txt dir /s \\server_name_and_path\*.avi >> \\path_to_output_file\Report.txt
I am looking for files in a particular directory that have the following extensions: .txt, .csv, and .xml. The directory has many levels of sub-directories that I would like to search through for all three file types in one go.
When I use Ctrl+F in Windows Explorer and enter extension types like *.txt;*.csv;*.xml, I watch the search bar fill up with green for a long time, but end up with no results. I know there are hundreds of these file types in the parent directory and sub-directories though.
How can I do a search like this in Windows 8 that returns results?
First change your
Dir command to look for
folder & "\*.*. While you’ve neglected to incude that important postion of your code, a
Dir list isn’t going to return anything that is outside of its file mask. Next, pull the file extension off the right hand end and compare it to a list of desired file extensions.
dim folder as string, pfile as string, ext as string folder = "c:\temp" pfile = Dir(folder & "\*.*") do while cbool(len(pfile)) ext = chr(32) & lcase(trim(right(replace(pfile, chr(46), space(99)), 99))) & chr(32) if cbool(instr(1, " pdf docx doc xls xlsx ", ext, vbTextCompare)) then 'do something with the matching file end if pfile = Dir loop