Tech Support > Operating Systems > MS-DOS > Batch file for outputting directory paths and file names to text file
Batch file for outputting directory paths and file names to text file
Posted by Danny on August 31st, 2004


Hey all. I know jack about batch files---very little; approaching zero. I
have about 50 file folders, and I would love to be able to run a batch file
that would place the file names, with full directory paths, into a single
text file for each of the files in all the 50 folders.


For instance, if I had the following files in the following directories...

C:\Windows\Desktop\Dr. Smith\
SmithAppendectomy.txt
SmithHeartBypass.txt

C:\Windows\Desktop\Dr. Jones\
JonesAppendectomy.txt
JonesLiverTransplant.txt

....I would need to be able to run the batch file and have it output to a
single plain text file something like the following:

C:\Windows\Desktop\Dr. Smith\SmithAppendectomy.txt
C:\Windows\Desktop\Dr. Smith\SmithHeartBypass.txt
C:\Windows\Desktop\Dr. Jones\JonesAppendectomy.txt
C:\Windows\Desktop\Dr. Jones\JonesLiverTransplant.txt


The batch file would definitely need to be capable of giving me the extended
file names rather than the 8-character DOS file names. I'm not sure how the
system actually maps the DOS file names to the Windows extended file names,
so there's another hurdle for me.

Is there such an animal out there? Any help would be MUCH appreciated.

Thanx!
-Danny


Posted by Herbert Kleebauer on August 31st, 2004


Danny wrote:
dir /b /s

Posted by Richard Bonner on August 31st, 2004


Danny wrote:
*** Oh, say "Hi" to Jack for me, then. (-:


*** See my batch file tutorial at:

http://www.chebucto.ns.ca/~ak621/DOS/BatBasic.html




*** Try this (untested):

DIR C:\Windows\Desktop /B /S > DOCTOR.txt


*** You would have to run this in a DOS window in order for it to
recognise long file names.

Richard Bonner
http://www.chebucto.ns.ca/~ak621/DOS/


Posted by Matthias Tacke on August 31st, 2004


Herbert Kleebauer wrote:

To be more precise and since Danny looks for textfiles. No batch
necessary - a simple command line is sufficient to redirect the file
listing into a textfiile.

dir /B /S *.txt >YourFile.txt
--
Greetings
Matthias

Posted by Danny on August 31st, 2004


The

DIR C:\Windows\Desktop /B /S > DOCTOR.txt

command worked like a charm!!!


Thanx so much, everybody!! ;-)

-Danny


"Danny" <danny.boy.1@comcast.net> wrote in message
news:CKydndeJtPeSQqncRVn-tQ@comcast.com...



Posted by Richard Bonner on September 1st, 2004


Danny wrote:
*** Glad to hear it did what you want.


*** You're welcome. It was brought to you by the great folks at
alt.msdos.batch. (-:

Richard Bonner
http://www.chebucto.ns.ca/~ak621/DOS/