Dos function for search files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
programchen
Posts: 10
Joined: 21 Nov 2011 23:43

Dos function for search files

#1 Post by programchen » 21 Nov 2011 23:52

in my C drive, I want to search all files which file name includes string *BEG*.
which command I should use?

also I want to find the directory name that has file name including string *BEG*.
which command I should use?

thanks

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Dos function for search files

#2 Post by Ed Dyreen » 22 Nov 2011 00:13

'
try:

Code: Select all

@echo off

dir /b "C:\*BEG*"
pause

dir /? |more

exit /b

programchen
Posts: 10
Joined: 21 Nov 2011 23:43

Re: Dos function for search files

#3 Post by programchen » 22 Nov 2011 01:22

no, I 'm asking how to find files with *BEG*. the file can be in root directory C", it can be in subfolder C:\abcd\efg\

I want to know both the file name and directory.

dir /b "C:\*BEG*" only check root directory

pls help. thanks

renzlo
Posts: 116
Joined: 03 May 2011 19:06

Re: Dos function for search files

#4 Post by renzlo » 22 Nov 2011 01:34

hi programchen,

Ed already showed you how to do it:

from dir /? command:
/S Displays files in specified directory and all subdirectories.


so it should be:
dir /s /b "C:\*BEG*"

-renzlo

programchen
Posts: 10
Joined: 21 Nov 2011 23:43

Re: Dos function for search files

#5 Post by programchen » 22 Nov 2011 01:53

thanks

Post Reply