Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search network drive and export result 1

Status
Not open for further replies.

joeh17

Technical User
Aug 28, 2006
11
0
0
US
What I would like to do is to search a network drive for all folders containing a certain word, namely "audit". Then would like that list exported to a text file. This would include the last modified date and the full path of the folder. Any ideas?

Thanks in advance.

-J
 
Open a command prompt, and type the following:

dir X: *audit* /AD /TA /Q > name_of_file_to_ouput.txt


Where X: is the dirve letter of the network drive.

the text between the * * is the text to look for, /AD limits the search to folders only, and TA show the last accessed date, and /Q shows who the folder belongs to.

For more options type dir /? at the command prompt.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks for the response. That much I could get figured out, but the piece I'm having trouble with is that I want it to look in all subdirectories as well. Is there a dir option for that as well? If so, I can't seem to find it.

Thanks again,
-J
 
You'll have to recurse through the subfolders. using a FOR contruct in a BAT file instead of a single command.

FOR %A DO (sub_directory_list) DO dir %%A ....

Someone with better Looping skills in a BAT file can post an example. As i'm not to handy with them.






----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Or, you could just add the /s param to make it include subfolders, i.e.

dir X: *audit* /AD /TA /Q /S > name_of_file_to_ouput.txt

Jock
 
Worked like a charm. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top