# Batch File : Find Specific Folder

March 21, 2011 at 21:36:46
Specs: Windows 7
 Looking for a way so search for a specific folder on a network Share and make that information into a variable.An Example of the full path to a folder is \\Storage\x\usernameThe issue is there are 3 other folders on \\Storage that I need to search for that user's.(\\Storage\w\ \\Storage\y\ \\ Storage\z\ if you were curious)I know I can use the %USERNAME% to get that part, but can't figure out how to do the search.

See More: Batch File : Find Specific Folder

#1
March 21, 2011 at 22:04:55
 Some Progress Made:FOR /f "tokens=*" %%N IN ('dir E:\*.* /A:D /S ^| find "%USERNAME%"') DO echo %%NI think I have gotten this working on a local level. (Some double check that fact plz)How can I make it work with the \\Storage share now ?

Report •

#2
March 22, 2011 at 05:31:41
 Untested:```for %%a in (w y z) do if exist \\storage\%%a\%username% set someDir=\\storage\%%a\%username% @echo %someDir%```How To Ask Questions The Smart Way

Report •

#3
March 23, 2011 at 17:43:45
 Razor, This worked perfectly. Many Thanks!

Report •
Related Solutions