Link to home
Start Free TrialLog in
Avatar of LarrySingleton
LarrySingleton

asked on

For /F search for MP3 files on remote servers

Trying to read through a text file to search remote servers(Win2K3/Win2K8) for *.mp3 items and output to txt (CSV would be even better!).  The text file is C:\Scripts\Server3.txt.  I want to search the D:\Data directories on all servers.  What I have so far is returning error "%%a is unexpected at this time":

FOR /F %%a IN (Servers3.txt) DO DIR /s *.mp3 >>C:\Scripts\MP3.txt

From researching, It appears I may need setlocal enableextensions and/or enabledelayedexpansion.

Also unclear whether it is more efficient to have the text file just read server name(server1) or the network path(\\server1\Data).  

Thanks  : )
SOLUTION
Avatar of Seyed Ali Fakoorpoor
Seyed Ali Fakoorpoor
Flag of Iran, Islamic Republic of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LarrySingleton
LarrySingleton

ASKER

Thanks for the quick response, but I'm still getting "%%f is unexpected at this time".
Please provide your complete batch script to solve the problem...
The batch script I attempted was from Ali listed directly under my question:

for /f %%f in (Servers3.txt) do dir %%f /s /a /b > C:\Scripts\MP3.txt

Servers3.txt just lists Server names.

I'll be glad to post whatever additional information you might need...

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am increasing points and accepting all solutions as Ali provided initial help, but didn't respond to error, Thommy explained the error,but also billprew went on to do the export to CSV.  I am dividing points to Ali, Thommy and billbrew 75/125/125

Thanks to all for your help.