Is there any way to create a meaningful list of all files on a device (drive, folder, usb stick), in such a way that they can be read into e.g. an MSAccess database, including directory structure, etc.?
When using the DOS based Dir to create a text file, the actual filenames are written last in each line, after an undeterminate number of folders and subfolders on the line.

5 Years
Discussion Span
Last Post by PhilliePhan

try using the /b, switch one directory or filename per line, with full paths. Dir /? will also show you more options.

Edited by tinstaafl


Try piping the output of a tree command to a txt file. Your dbase may not be able to cope with the non-alphanumerics, though...
eg: tree G: /F > C:\filelist.txt


There are a number of program's under google "directory print" that will do the job you require very easily and can be saved in text form to use in other program's. one or two of those results are already built into later versions of windows already to use


Thanks for your contributions.
Neither Dir or Tree piped to a text file give results that are easy to make any access database or a spreadsheet from if the files are spread over a number of subdirectories.
I have tried DirPrintAdvanced, but it appears to be quite slow for the large directory trees that I want to catalogue.


Using a command like this

dir /b /s c:\test3\*.* >c:\test1.txt

produces an output like this


If you don't want the directories listed you can use this

dir /b /s /a:-d c:\test3\*.* >c:\test1.txt

How much simpler an output do you need?

Edited by tinstaafl


Looks like it provides a little more functionality than doing a search with DIR. One thing that always pissed me off about DIR is that wildcard searches also match of the hidden 8.3 file name which tends to generate head-scratching results when you are looking for files. Unfortunately, the same odd behaviour applies when doing a DEL which can lead to disastrous results. I've complained to Microsoft a half dozen times over the last dozen years.

Does LOCATE exhibit the same bizarre behaviour?

By the way, it can be downloaded here

Edited by Reverend Jim


I'm not sure what you are getting at.

Locate.com searches using the 8.3 file names, but there are a ridiculous number of switches and macros you can use to weed out the stuff you don't want.

The OP could simply run Locate.com with no switches and get the output he desires. The /L switch would give the long file name. Better yet, locate /O:"&W" would provide a bare list in long name form.
I used it mainly with batch files to pinpoint files created during a certain time and then to filter that list. Great for malware hunting.

But I'm rambling. As far as wild card searches go, I've always been able to filter out the stuff I don't want either via the switches and macros or via a few extra commands.

I am not as up-to-date as I used to be, so I don't know if there is a better alternative to Locate.com floating around these days, but somehow I doubt it :) - at least not free....

Cheers :)

Edited by PhilliePhan

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.