How can I print the list of files in a folder to another file?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

There are times when I would like to make a list of the folders in a
directory or the files in a folder. I recall being able to do this in DOS
with a comman like Dir a: (etc).
 
Dim strFolder As String
Dim strFile As String

strFolder = "C:\Data Files\"
strFile = Dir(strFolder & "*.*")
Do While Len(strFile) > 0
Debug.Print strFolder & strFile
strFile = Dir()
Loop
 
This group is about Microsoft Access the database.

You can get a directory lisiting into a file:
dir a:\ /s /a >files.txt
Then use notepad to open the text file and print it.
 

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

Back
Top