1.

Solve : Output Directory Listing to File?

Answer»

Hey all:

I want to create a way to quickly create a TXT file with a list of a subdirectory's files.

I know I can manually go through the cmd prompt and do

dir >whatever.txt

But that's not my IDEA of "quick".

What I did was create a batch file:

@echo off
dir %1 /-p /o:gn /b> "subdir.txt"
exit

...which I can then access by RIGHT clicking on a subdirectory.

What I'd like to do is change the "subdir.txt" part to either automatically name the new file after the subdirectory, or if that can't be, prompt me for a name.

So, what happens right now is:
Let's say I have three subdirectories in a My Documents:

  • Documents 1
  • Documents 2
  • Spreadsheets
When I go to My Documents, I right-click on "Documents 1", and it creates a new file called "subdir.txt" in the My Documents folder. If I right-click on "Documents 2", it will overwrite "subdir.txt" with the new content.[/i]

What I'd like to do is right-click on "Documents 1" and get a file back called "Documents 1.txt" or "DOCUME~1.txt" or at least a prompt for what to call it.

Is that do-able?

Thanks!
I have a similar problem.

I want to manually send multiple dir listings to a single file.

I use dir > C:\my-file.doc, and this is OK!
But when I do it to the next dir, it OVER-WRITES writes the first file.
--
I am looking for a simple command at the end of the command string that would allow me to "append" or add it to the current file.
--
I am an old Cobol programmer and it seems to me that years ago, that there was a way to do this in DOS.
--
Pat O'Mahony [emailprotected]

end of message

Use >> to append to a fileThat worked perfectly; FIT the BILL... I'd still like to know if there's a way to automatically name a file after its subdirectory?

Thanks


Discussion

No Comment Found