please help - how to get a list of subfolders redirected to a txt

G

Guest

In windows XP, how do I get a list of subfolders within a main folder and
redirect the output to a txt file? I have a folder with a lot of (80+)
sub-folders and I need to list those sub-folder names in an email or as an
attachment to an email. Without being able to create that list into a file, I
only one have one choice that is to type in those sub-folder names one by
one. Please help.

In those DOS days, I was able to CD to the main folder and issue the command
"dir >temp.txt" and this produced a list of all the files and folders under
the main folder into the new file temp.txt. That list even contained the 0
length file temp.txt! I don't know how to do that from a DOS windows under
windows XP - the CD command fails when I change directory to 'My Documents' -
CD command does not like the space between 'My' and 'Documents'.
 
N

Nepatsfan

(e-mail address removed),
Jay87 said:
In windows XP, how do I get a list of subfolders within a
main folder and redirect the output to a txt file? I have a
folder with a lot of (80+) sub-folders and I need to list
those sub-folder names in an email or as an attachment to an
email. Without being able to create that list into a file, I
only one have one choice that is to type in those sub-folder
names one by one. Please help.

In those DOS days, I was able to CD to the main folder and
issue the command "dir >temp.txt" and this produced a list
of all the files and folders under the main folder into the
new file temp.txt. That list even contained the 0 length
file temp.txt! I don't know how to do that from a DOS
windows under windows XP - the CD command fails when I
change directory to 'My Documents' - CD command does not
like the space between 'My' and 'Documents'.

Have you tried putting quotation marks around "My Documents".

Nepatsfan
 
G

Guest

Yes. I tried single, double and reverse quotes but none of them worked. I get
error messages like 'invalid switch' 'too many parameters', etc. Thanks for
your quick response though.
 
W

Wesley Vogel

You have to include the entire path to My Documents.

If you do not know the path..
Locate My Documents shortcut and right click |
Properties | Target tab | Copy the path from the Target box

-----------
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>cd C:\Documents and Settings\Wesley P. Vogel\My Documents

C:\Documents and Settings\Wesley P. Vogel\My Documents>dir >temp.txt

C:\Documents and Settings\Wesley P. Vogel\My Documents>
------------

I use this...

Add a Print Directory Feature for Folders in Windows XP
http://www.mvps.org/sramesh2k/PrintDirectory.htm

Add a Print Directory Feature for Folders in Windows XP
http://support.microsoft.com/default.aspx?scid=kb;en-us;321379

That way there is a Print Directory option in the Context menu.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
M

Mike Hyndman

Jay87 said:
Yes. I tried single, double and reverse quotes but none of them worked. I
get
error messages like 'invalid switch' 'too many parameters', etc. Thanks
for
your quick response though.
N,
To print a list of files in the My Docs folder, try "CD"ing to the My Doc's
parent folder.
Then type "dir C:\My Documents>filename.txt" without quotes.

HTH
MH
 
M

Mike Hyndman

Jay87 said:
Yes. I tried single, double and reverse quotes but none of them worked. I
get
error messages like 'invalid switch' 'too many parameters', etc. Thanks
for
your quick response though.
N

CORRECTION, its PRN not DIR


To print a list of files in the My Docs folder, try "CD"ing to the My Doc's
parent folder.
Then type "PRN C:\My Documents>filename.txt" without quotes.

HTH
MH
 
L

LVTravel

Jay, Click Start, Run and type CMD then press enter.

CD to the folder you want to obtain the directory listing for.

To obtain the listing of just that folder type DIR >TEXTNAME.TXT and press
enter
This will place the textname.txt file in the default folder

To obtain the listing of the folder and any subfolders (in directory order)
type DIR >TEXTNAME.TXT /S and press enter

When I played with your problem on my computer here is what I accomplished:

From the DOS prompt C:\> I typed CD DOCUMENTS AND SETTINGS\MYNAME and hit
the enter key. The default command prompt was set as C:\DOCUMENTS AND
SETTINGS\MYNAME > which meant that I was defaulted to that location. I then
typed DIR >TEST.TXT /S and pressed enter. After about 20 seconds I had a
text file containing all my files from my profile.
 
W

Wesley Vogel

That isn't going to work. The path is incorrect.

C:\My Documents is not correct. It is %userprofile%\My Documents

-----
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>cd C:\My Documents
The system cannot find the path specified.

C:\>cd %userprofile%\My Documents

C:\Documents and Settings\Wesley P. Vogel\My Documents>dir >temp.txt

C:\Documents and Settings\Wesley P. Vogel\My Documents>
-----

--

Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
M

Mike Hyndman

Wesley Vogel said:
That isn't going to work. The path is incorrect.

C:\My Documents is not correct. It is %userprofile%\My Documents
Wes,
It worked for me. C:\My Docs is correct when issued from the My Docs parent
folder.

Regards
Mike H
 
M

Mike Hyndman

Wesley Vogel said:
That isn't going to work. The path is incorrect.

C:\My Documents is not correct. It is %userprofile%\My Documents
Wesley,
Scrub the first reply, the medication must be wearing off, you're correct,
it doesn't work, couldn't work, can't get yours to work either. Could always
do a print screen. ;-)
I can hear the nurse....

Regards
Mike H
 
W

Wesley Vogel

Try using cmd.exe instead of command.com.

command.com cannot handle long filenames.

If you must use command.com, try using cd MYDOCU~1

command.com...
-----
Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.

C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>cd %userprofile%\My Documents
Too many parameters - Documents

C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>cd %userprofile%\MYDOCU~1
Invalid directory

C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>cd MYDOCU~1

C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>
C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>
C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>dir >temp.txt

C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>
-----

cmd.exe...
-----
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>cd %userprofile%

C:\Documents and Settings\Wesley P. Vogel>
C:\Documents and Settings\Wesley P. Vogel>
C:\Documents and Settings\Wesley P. Vogel>cd %userprofile%\My Documents

C:\Documents and Settings\Wesley P. Vogel\My Documents>
C:\Documents and Settings\Wesley P. Vogel\My Documents>
C:\Documents and Settings\Wesley P. Vogel\My Documents>
C:\Documents and Settings\Wesley P. Vogel\My Documents>
---------------

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
W

Wesley Vogel

LOL

Mike,

cd %userprofile%\My Documents
doesn't change the prompt to
DRIVELETTER:\Documents and Settings\Your Name Here\My Documents>

dir >temp.txt
or
dir >whatevername.txt
should create a whatevername.txt file in the folder that cmd was in when you
type the dir > command.

Are you using command.com also?

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
M

Mike Hyndman

Wesley Vogel said:
LOL

Mike,

cd %userprofile%\My Documents
doesn't change the prompt to
DRIVELETTER:\Documents and Settings\Your Name Here\My Documents>

dir >temp.txt
or
dir >whatevername.txt
should create a whatevername.txt file in the folder that cmd was in when
you
type the dir > command.

Are you using command.com also?

--
Wesley,

Muchos gracias, I'll remember this the next time I need to print out a
folder's contents. ;-)
The last time I needed to do this it was on an amber monitor with dark green
text outputing to a 105dB dot matrix printer;-)
I was using cmd.
Lights out

Mike H
 
G

Guest

Bingo. It worked. Using cmd.exe, I could cd to the folder and did a dir >fn.txt
Thank you.
Jay

Wesley Vogel said:
Try using cmd.exe instead of command.com.

command.com cannot handle long filenames.

If you must use command.com, try using cd MYDOCU~1

command.com...
-----
Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.

C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>cd %userprofile%\My Documents
Too many parameters - Documents

C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>cd %userprofile%\MYDOCU~1
Invalid directory

C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>cd MYDOCU~1

C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>
C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>
C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>dir >temp.txt

C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>
-----

cmd.exe...
-----
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>cd %userprofile%

C:\Documents and Settings\Wesley P. Vogel>
C:\Documents and Settings\Wesley P. Vogel>
C:\Documents and Settings\Wesley P. Vogel>cd %userprofile%\My Documents

C:\Documents and Settings\Wesley P. Vogel\My Documents>
C:\Documents and Settings\Wesley P. Vogel\My Documents>
C:\Documents and Settings\Wesley P. Vogel\My Documents>
C:\Documents and Settings\Wesley P. Vogel\My Documents>
---------------

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Jay87 said:
Yes. I tried single, double and reverse quotes but none of them worked. I
get error messages like 'invalid switch' 'too many parameters', etc.
Thanks for your quick response though.
 
W

Wesley Vogel

There's always something, isn't there?

Keep having fun! :)

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Jay87 said:
Bingo. It worked. Using cmd.exe, I could cd to the folder and did a dir
fn.txt Thank you.
Jay

Wesley Vogel said:
Try using cmd.exe instead of command.com.

command.com cannot handle long filenames.

If you must use command.com, try using cd MYDOCU~1

command.com...
-----
Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.

C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>cd %userprofile%\My Documents
Too many parameters - Documents

C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>cd %userprofile%\MYDOCU~1
Invalid directory

C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>
C:\DOCUME~1\WESLEY~1.VOG>cd MYDOCU~1

C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>
C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>
C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>dir >temp.txt

C:\DOCUME~1\WESLEY~1.VOG\MYDOCU~1>
-----

cmd.exe...
-----
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>cd %userprofile%

C:\Documents and Settings\Wesley P. Vogel>
C:\Documents and Settings\Wesley P. Vogel>
C:\Documents and Settings\Wesley P. Vogel>cd %userprofile%\My Documents

C:\Documents and Settings\Wesley P. Vogel\My Documents>
C:\Documents and Settings\Wesley P. Vogel\My Documents>
C:\Documents and Settings\Wesley P. Vogel\My Documents>
C:\Documents and Settings\Wesley P. Vogel\My Documents>
---------------

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Jay87 said:
Yes. I tried single, double and reverse quotes but none of them worked.
I get error messages like 'invalid switch' 'too many parameters', etc.
Thanks for your quick response though.

:

(e-mail address removed),
In windows XP, how do I get a list of subfolders within a
main folder and redirect the output to a txt file? I have a
folder with a lot of (80+) sub-folders and I need to list
those sub-folder names in an email or as an attachment to an
email. Without being able to create that list into a file, I
only one have one choice that is to type in those sub-folder
names one by one. Please help.

In those DOS days, I was able to CD to the main folder and
issue the command "dir >temp.txt" and this produced a list
of all the files and folders under the main folder into the
new file temp.txt. That list even contained the 0 length
file temp.txt! I don't know how to do that from a DOS
windows under windows XP - the CD command fails when I
change directory to 'My Documents' - CD command does not
like the space between 'My' and 'Documents'.

Have you tried putting quotation marks around "My Documents".

Nepatsfan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top