Searching for multiple file extents

Associate
Joined
29 Jun 2009
Posts
148
Location
London
Dear All,

I would like to know the easiest way of searching for multiple files i.e .mkv, avi, mp3 etc from local drives, DNS-323 and USB drives. Have them exported to a text file or csv file with it showing info like folder location, album, artist etc.

Any ideas or solutions.

Bashy
 
http://www.voidtools.com/

I use something called everything to search on my system, really useful. It wont do the exporting etc but then I don't think there is anything to do that in an automated way.

Thanks. I will try the link. I didn't mean automatically. I was looking in the lines of a script.

I have never created a script, so haven't got a clue where to start.

Bashy
 
Powershell one-liner!

Code:
gci "C:\my path" -include @("*.mp3", "*.mkv", "*.avi") -recurse | select Name, FullName | out-file "C:\output.txt"

Just add more file types in the format "*.ext" in the line above to search for more items, separated by a comma.

You may get access denied errors on Windows system folders, but media isn't likely to be in those anyway. You will need to rerun the one-liner for each drive/directory you wish to search. I can do you a more complete script, but I dunno if you even have powershell installed! :p
 
Last edited:
Thanks SiriusB.

I will get powershell installed.

With the above command it is just to add information for example say artist like
gci "C:\my path" -include @("*.mp3", "*.mkv", "*.avi") -recurse | select Name, FullName, Artist | out-file "C:\output.txt"

Also I would like to extent the path as it is shown as C:\Program Files\Common Files\micros...

Also can I edit the script to make it scan multiple drives and NAS

Bashy.
 
Last edited:
if you don't have powershell, use good old cmd prompt:

Code:
@echo off
SETLOCAL
SET paths_to_search="c:\" "z:\in" "v:\install"

SET types_to_search=jpg tif exe


CALL :do_search_pth %paths_to_search%
GOTO :EOF


:do_search_pth
	ECHO Searching in location: %1
	CALL :do_search_typ %1 %types_to_search%
	SHIFT
	
	IF "%1"=="" (
		GOTO :EOF
	) ELSE (
		GOTO :do_search_pth
	)
GOTO :EOF

:do_search_typ
	SET location=%1
	SHIFT
	
:do_search_typ_main	
	ECHO Searching for filetypes: %1
	CALL :do_search %1 %location%
	SHIFT
	
	IF "%1"=="" (
		GOTO :EOF
	) ELSE (
		GOTO :do_search_typ_main
	)
GOTO :EOF

:do_search
FOR /F "tokens=*" %%A IN ('dir %2\*.%1 /b /s /a-d') DO (
	ECHO %%A
)

GOTO :EOF


Run it like filesearch.bat > c:\list.txt


Anyone know how to get it to handle spaces in the 'search paths'?

If anything it's a good example of the difference between xp cmd and powershell : )
 
Thanks SiriusB.

I will get powershell installed.

With the above command it is just to add information for example say artist like
gci "C:\my path" -include @("*.mp3", "*.mkv", "*.avi") -recurse | select Name, FullName, Artist | out-file "C:\output.txt"

Also I would like to extent the path as it is shown as C:\Program Files\Common Files\micros...

Also can I edit the script to make it scan multiple drives and NAS

Bashy.

Unfortunately Powershell can only read file properties. Name and FullName above are the file name and full file path respectively. To read MP3 and other media tags would require the use of a tagging module [which exists and I have played with in the past, but is a little more involved]. However, if you want me to I can write a full blown script and instructions on getting it set up.
 
Unfortunately Powershell can only read file properties. Name and FullName above are the file name and full file path respectively. To read MP3 and other media tags would require the use of a tagging module [which exists and I have played with in the past, but is a little more involved]. However, if you want me to I can write a full blown script and instructions on getting it set up.

If you have the time that would be great.

Bashy.
 
Can't promise how soon as I will need to reacquaint myself with the tagging library. Not sure right now which tags it supports either.

To be honest, if you want something to find all the media on your computer I suspect there are dedicated programs! I will give this a shot though! :)
 
to get tags from mp3s:

install foobar2000 (in portable mode if you have no intention of using/keeping it).

open file>preferences>media library and add your music folders. click apply - it may take awhile to index all the files.

still in the preferences, goto advanced>display>legacy title formatting settings>copy command.

in here you can put the tags you want it to display. also you can get the full path to the file using %path%. full documentation on syntax can be found here....

http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference

as an example, i can put this....

Code:
%artist% - %title% - %path%

now close the preferences and goto the library menu>search. type in

Code:
ALL

(must be uppercase)

now highlight all the files and hold down the shift key. now right click and select "copy names". now you can paste the output into a text editor and you'll get something like this....
Code:
Bruno Coulais - End Credits - D:\Music\Albums\MP3\Bruno Coulais\Coraline\01. End Credits.mp3
Bruno Coulais - Dreaming - D:\Music\Albums\MP3\Bruno Coulais\Coraline\02. Dreaming.mp3
Bruno Coulais - Installation - D:\Music\Albums\MP3\Bruno Coulais\Coraline\03. Installation.mp3
Bruno Coulais - Wybie - D:\Music\Albums\MP3\Bruno Coulais\Coraline\04. Wybie.mp3
 
to get tags from mp3s:

install foobar2000 (in portable mode if you have no intention of using/keeping it).

open file>preferences>media library and add your music folders. click apply - it may take awhile to index all the files.

still in the preferences, goto advanced>display>legacy title formatting settings>copy command.

in here you can put the tags you want it to display. also you can get the full path to the file using %path%. full documentation on syntax can be found here....

http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference

as an example, i can put this....

Code:
%artist% - %title% - %path%

now close the preferences and goto the library menu>search. type in

Code:
ALL

(must be uppercase)

now highlight all the files and hold down the shift key. now right click and select "copy names". now you can paste the output into a text editor and you'll get something like this....
Code:
Bruno Coulais - End Credits - D:\Music\Albums\MP3\Bruno Coulais\Coraline\01. End Credits.mp3
Bruno Coulais - Dreaming - D:\Music\Albums\MP3\Bruno Coulais\Coraline\02. Dreaming.mp3
Bruno Coulais - Installation - D:\Music\Albums\MP3\Bruno Coulais\Coraline\03. Installation.mp3
Bruno Coulais - Wybie - D:\Music\Albums\MP3\Bruno Coulais\Coraline\04. Wybie.mp3

Thanks Marc. I will give it a try tonight.

Bashy.
 
Back
Top Bottom