DOS directory help needed

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

pentagalith

Thread Starter
Joined
Jan 10, 2006
Messages
2
I am working on a batch file in 6.22 that looks through all subdirectories(like using dir/s) of a folder and lists all filenames of a given extension into a single textfile with a filename appropriate to the extension, for instance if my batch was ML.BAT and I was in C:\BACKUPS> then ML 110 should send all files with a .110 extension into LIST110.TXT
The catch is I need them to come out in the same format as you would get by using
dir /b *.110 > list110.txt
I know that by using this does not include subdirectories, which is what I am looking for and playing around with TREE has given me very messy results.
I am looking to just have the filenames only all together as one list
ML.BAT
@ECHO OFF
DIR /B *.%1 > LIST%1.TXT

This does what I'm looking for but applies only to the current directory. I need better.

Is it possible to say: go into the first child, write all appropriate filenames to destination text file, go into next child, add all filenames, go into next child... etc.
Please help. Thank you.
 
Joined
Apr 29, 2004
Messages
7,218
I just ran a test for all PDF's.

DIR /S *.pdf > C:\list.txt


This found ALL PDFs on my C: drive and sent the output to a file (List.txt) on my C: , Open list.txt and all PDFs are listed.

Not sure if this will help..
 

pentagalith

Thread Starter
Joined
Jan 10, 2006
Messages
2
I have that in my original post, what I am looking for is a way to get all of these filenames only, if I run ML.BAT from C:\>ml 110
and I only have C:\BACKUPS\02-11-05\REGB\GENDIO.110
and C:\BACKUPS\17-06-04\REGG\IODIAG.110
I want my text file to show ONLY:

GENDIO.110
IODIAG.110

I don't want to see paths. Only the names.

Is it possible to move laterally through childs?
with CD.. you can move to the parent, is there a way through batch code you can move to the next lateral child and then add the results to an existing text file?
 

Squashman

Retired Trusted Advisor
Joined
Apr 4, 2003
Messages
19,786
That is something I have never been able to figure out in dos batch files. It is very easily done in Linux Bash scripts. I have never been able to figure out how to get the basename in a batch file.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top