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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List of Files

Status
Not open for further replies.

Karbi

IS-IT--Management
Jun 1, 2009
5
IN
How to get a list of filenames starting with A or B (ignore case) ?
 
You can generate a list of file names using the DIR command and out put it to a file.

Once you have that list, import it into Excel or similar application.



ACSS - SME
General Geek

 
You can use a
Code:
[highlight #000000][COLOR=#D3D7CF]dir a*.* > list.txt  

or 

dir b*.* > list.txt[/color][/highlight]
to get that specific list.

----------------------------------
Phil AKA Vacunita
----------------------------------
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.

Web & Tech
 
Thank you guys...

Is it possible to specify the range of alphabets in a single command. I mean I want the list of files starting from all the alphabets between A and M.

Thanks in Advance
 
Then do a DIR *.* /b >list.txt and import the list in Excel and do your filtering inside Excel.
Execute a DIR /? for all the switches you can use.
 
Another batch-only alternative:
Code:
dir a*.* > list.txt
dir b*.* >> list.txt
dir c*.* >> list.txt
...
dir m*.* >> list.txt

">" creates a new file (or overwrites if the file exists), while ">>" appends to an existing file
 
Try
Code:
dir /b | findstr /r /c:"^[A-Ma-m].*"
 
Awesome xwb....It works like a charm...
This is what I want....
I want the result in a single command.

Could please let me know what for the . and * are there after [A-Ma-m] ?

Thanks in advance..
 
The * is a wildcard character. So .* covers all file extensions, like .txt, .doc, etc.

-Carl
"The glass is neither half-full nor half-empty: it's twice as big as it needs to be."

[tab][navy]For this site's posting policies, click [/navy]here.
 
In findstr, * is not the wildcard character . is the wildcard character. See findstr /? for more details.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top