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.

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

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
M

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.
O

Using a command like this

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

produces an output like this

c:\test3\test.txt
c:\test3\Test1.txt
c:\test3\Test2.txt
c:\test3\Test4
c:\test3\Test5
c:\test3\Test4\test.txt
c:\test3\Test4\Test1.txt
c:\test3\Test4\Test2.txt
c:\test3\Test5\test.txt
c:\test3\Test5\Test1.txt
c:\test3\Test5\Test2.txt

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?

Hey guys,

Sorry I missed this thread, but one of my favorite old freeware tools (Charles Dyes's Locate.com) ought to do the trick.
It is ridiculously useful!

Here's how to use it:
ftp://ftp.scientificlinux.org/linux/fermi/obsolete/90rolling/i386/misc/superduperrescue/fermi/FREEDOS/FDOS/DOC/LOCATE/LOCATE.TXT

Finding it for download may be a bit harder - If all else fails, I can provide a copy.

Cheers :)
PP

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

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 :)
PP

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.