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!

Need a DIR command to get list of files only within subfolders 1

Status
Not open for further replies.

bmacbmac

IS-IT--Management
Jan 26, 2006
392
US
Hi,

I need to get a list of files in several hundred folders. I need just the filename only.

If I try this:

Code:
dir /s D*.*

I get all of the files, but also get the date, time, and file size.


If I try this:
Code:
dir /s /b D*.*

I get all of the files, but the entire drive\folder\subfolder is included.

For example, I just want
D00000001.001
D00000002.001

But I get
c:\images\imageset1\D0000001.001
c:\images\imageset1\D0000002.001

Is there a way I can get just the list of images?

Thanks!

Brian
 
Hmmm, not through the DIR command directly. Which makes sense, because you can have the same filename in different subfolders, and if "DIR /s /b" suppressed the full path, you might see filenames repeated, causing confusion.

Many options to get what you want, but they all involve an extra step or two. One way is to pipe the output to a text file, and clean it up manually, or run a macro or vbscript to go line-by-line, find the last backslash, and delete it and all characters before it.
 
I found the magic commands to make this happen. In command prompt change the directory the exact one you want (example: c:\network\users\MeMyselfIrene) Once it was in the correct directory you add
DIR>whateveryouwanttonameit.txt
This should create a txt document with the list of folders, from there just open it with excel and get rid of what you don't want.
 
Thanks for the replies.

Guitarzan - I ended up piping out to a text file and used Excel to parse out what I needed. Was hoping to skip this step and just get a raw list, but your duplicate comment totally makes sense as to why this wouldn't work.

YWCA - Thanks as well. Unfortunately I need the files, not the folders. My files are in hundreds of subfolders.

Thanks!
 
google Karen's Power Tools and download her DIR Print program.

i think you will find it fits your need.

been using it for a couple years and works nicely
 
eyec,

Wow I came across that program many years ago and completely forgot about it, and all the options it gives... All things considered, it's about the easiest "extra step" do get the info requested by the OP; if you go to the "Save to Disk" tab, click "File Info Only", and un-check all options except "File Name", you get EXACTLY what the OP asked. Good catch, have a star...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top