There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
DOS/PDA/Other
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > DOS/PDA/Other >
DOS directory help needed


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
pentagalith's Avatar
Junior Member with 2 posts.
 
Join Date: Jan 2006
10-Jan-2006, 09:57 AM #1
DOS directory help needed
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.
bill.aam's Avatar
Distinguished Member with 5,483 posts.
 
Join Date: Apr 2004
Location: Florida
Experience: Advanced
10-Jan-2006, 10:51 AM #2
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's Avatar
Junior Member with 2 posts.
 
Join Date: Jan 2006
10-Jan-2006, 11:08 AM #3
I have already come across this
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's Avatar
Distinguished Member with 12,598 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
10-Jan-2006, 12:25 PM #4
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.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:35 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.