• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1835
  • Last Modified:

How to search file name using dos in windows

How do you find files in dos in windows, basically I want to create a batch file which finds files with specific name and creates an another text file with all of those files. For example, if I have 100 files in C:\test and only 5 files contains abcd or pqrs in the filename, it should print only those files and nothing else.

Prompt response will be highly appreciated.

Thanks,

-Ashutosh
0
ashutoshg2006
Asked:
ashutoshg2006
  • 2
1 Solution
 
DiscoNovaCommented:
dir *abcd*.*
...and...
dir *pqrs*.*

...unfortunately dir is only able to look for one thing at a time (that is, if you want to find something you need "OR-logic", you need to find them in separate runs.
0
 
ghostdog74Commented:
you can try dir /S | findstr "your search string"
0
 
DiscoNovaCommented:
@ghostdog74: Much better than my approach. Must admit that that ("findstr") was entirely new command for me (though it must be said that I hardly ever use Windows' command line any more). Too bad that /S doesn't keep the directory name with the filename - otherwise that'd be really usefull...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now