Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing contents of My Documents file folder

Status
Not open for further replies.

jooleigh

MIS
Oct 21, 1999
10
0
0
US
Is it possible to print out a list of all the documents in the "My Documents" folder?
 
Either do a screen capture and paste it into Word to print or go to the command line in c:\my documents and type the following: &quot;dir *.* &gt; docs.txt&quot; then open C:\My Documents\Docs.txt in notepad and print it. <p> Jeff<br><a href=mailto: masterracker@hotmail.com> masterracker@hotmail.com</a><br><a href= > </a><br>
 
Cool MasterRacker <br>
I knew there was a way to print it out.<br>
I'm going to take it a step further and make a Visual Basic program (.EXE) that does it all in one shot.<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Actually I have found a better way. Use the TREE command. One of the problems in the past with TREE is that it uses extended characters to draw the tree, which causes a mess when viewed in Windows fonts. However, under NT the command has an option to use lower ACSII characters to draw the tree and now, TREE can also display file names.<br>
<br>
CD to My Documents and do &quot;TREE /A /F &gt; OUTPUT.TXT&quot;. This one will display all file names and the folder structure. <p> Jeff<br><a href=mailto: masterracker@hotmail.com> masterracker@hotmail.com</a><br><a href= > </a><br>
 
Check out <A HREF=" TARGET="_new"> I don't know if CDIndex is the right tool, but it might be.<br>
<br>
<p>Gary (akbryer)<br><a href=mailto:Gary_Bryer@Vanguard.com>Gary_Bryer@Vanguard.com</a><br><a href= > </a><br> <br>
<br>
Good deeds do not go unrewarded!
 
Below is an excerpt from WordTips (12/11/99). Hope this is helpful. I haven't tried it.<br>
------------------------------<br>
Printing a File List<br>
------------------------------<br>
Many users of WordPerfect may be familiar with the feature that allows<br>
you to print the contents of a directory. Indeed, it can be very handy<br>
to have a printout of all the documents in a directory. Unfortunately,<br>
Word does not have an intrinsic command that allows you to accomplish<br>
the same task. There are a couple of ways you can approach this<br>
problem, however.<br>
<br>
The first is the old tried-and-true DIR method, which has been used by<br>
&quot;techies&quot; since the days of DOS. Simply open a command prompt (MS-DOS)<br>
window, locate the directory of which you want a list, and then type<br>
the following command:<br>
<br>
dir /b &gt; mydir.txt<br>
<br>
This creates a text file (mydir.txt) that contains only the names of<br>
the files in the directory. You can then locate the file in Word and<br>
load it as a document. While this approach is not a single step, it is<br>
not particularly difficult, either.<br>
<br>
If you are using Word 97 or Word 2000 and would like a macro solution<br>
to the problem, you can use the following. It displays the standard<br>
Open dialog box, in which you can browse for the directory of which<br>
you want a list. When you select a file in that directory and click on<br>
Open, the macro creates a new Word document that lists all the files<br>
that the directory contains. Note that you must select a file from the<br>
directory.<br>
<br>
Sub ListFiles()<br>
Dim PathWanted As String<br>
Dim Temp As String<br>
Dim i As Integer<br>
<br>
With Dialogs(wdDialogFileOpen)<br>
.Name = &quot;*.*&quot;<br>
If .Display = -1 Then<br>
Documents.Add<br>
PathWanted = Options.DefaultFilePath(wdDocumentsPath)<br>
Selection.TypeText &quot;Files in &quot; & PathWanted & &quot;:&quot; & vbCrLf<br>
With Application.FileSearch<br>
.LookIn = PathWanted<br>
.FileName = &quot;*.*&quot;<br>
If .Execute &gt; 0 Then<br>
For i = 1 To .FoundFiles.Count<br>
Temp = .FoundFiles(i)<br>
While InStr(Temp, &quot;\&quot;) &gt; 0<br>
Temp = Mid(Temp, InStr(Temp, &quot;\&quot;) + 1)<br>
Wend<br>
Selection.TypeText Temp & vbCrLf<br>
Next<br>
End If<br>
End With<br>
End If<br>
End With<br>
End Sub<br>
<br>
If you want to limit the files returned by the macro (for instance, to<br>
only those ending in .DOC), then you can change the file<br>
specifications (&quot;*.*&quot;) in two of the program lines.<br>
<p>Gary (akbryer)<br><a href=mailto:Gary_Bryer@Vanguard.com>Gary_Bryer@Vanguard.com</a><br><a href= > </a><br> <br>
<br>
Good deeds do not go unrewarded!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top