How can you list ALL the files on your computer in a single list that you can sort and/or edit using Excel and that includes file size and location, etc.?

(This was easy in the old MS DOS days, but a way to do this in Windows eludes me. I don't know how to get My Computer or Windows Explorer to show me the whole tree of files, and their displays can't be cut and pasted or otherwise edited and saved. Am I missing something obvious. . . ?)

I'm using Windows XP Pro and Office Pro.

In advance, thank you.

Dani AI

Generated

Building on 's handy command‑line approach, here's an alternative that creates a clean CSV ready for Excel without fiddling with the DIR output. Save the script below as ListAllFiles.vbs and run it (it walks all ready drives and writes FullPath, Size (bytes) and Modified date to a CSV on your Desktop).

' ListAllFiles.vbs — saves AllFiles.csv to your Desktop
Option Explicit
Dim fso, shell, outFile, outPath
Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("WScript.Shell")
outPath = shell.SpecialFolders("Desktop") & "\AllFiles.csv"
Set outFile = fso.CreateTextFile(outPath, True, False)  ' change last param to True for Unicode
outFile.WriteLine """FullPath"",""Size"",""Modified"""
Dim drv
For Each drv In fso.Drives
  If drv.IsReady Then EnumerateFolder drv.RootFolder
Next
outFile.Close
WScript.Echo "Saved: " & outPath

Sub EnumerateFolder(folder)
  Dim f, sf
  For Each f In folder.Files
    outFile.WriteLine """" & Replace(f.Path, """", """""") & """," & f.Size & ",""" & f.DateLastModified & """"
  Next
  For Each sf In folder.SubFolders
    EnumerateFolder sf
  Next
End Sub

Notes and quick tips:

  • If Excel shows everything in one column, use Data → Text to Columns (comma delimited) or import the CSV via Excel's From Text wizard. Newer Excel (2007+) supports 1,048,576 rows; Excel 2003 is limited to 65,536 rows — plan accordingly.
  • If filenames include non‑ASCII characters, set the CreateTextFile third parameter to True to write Unicode.
  • Expect a long run on big drives; permissions or locked files may prevent some entries from being listed. For extremely large catalogs, consider importing the CSV into Access or a database rather than Excel.
  • This complements 's DOS trick: use whichever fits your workflow. If you need additional columns (attributes, owner, MD5), the script can be extended or replaced with a specialist tool.

Recommended Answers

All 4 Replies

Hi wwwusuario1, welcome to DaniWeb :)

Using DOS is still one easy way of doing what you want to do:

1. Open an MS-DOS box:

- Click on the "Run..." option in your Start menu
- In the resulting "Open:" box, type the following and then click "OK":

CMD

2. At the command prompt in the DOS window:

- Type CD C:\ and then hit Enter.
- Type dir /A/S >AllFiles.txt and then hit Enter.

The above version of the dir command will create a text file named "AllFiles.txt" in your C:\ directory which contains a listing, by directory, of all files on your C: drive. The default listing will include each file's date/time stamp and size, but you can modify which file attributes are included by adding the apprpriate switches to the dir command (type dir /? for help on that).


3. The contents of the AllFiles.txt file can then be imported into an Excel worksheet if you want to manipulate the individual filedata, although you should be aware that the entire contents of the file may not fit onto one worksheet:

- Open a new worksheet in Excel.
- Under the "Data" menu, go to Import External Data->Import Data...
- In the resulting Select Data Source window, navigate to the C:\AllFiles.txt file and double-click on it to begin the import process.
- Follow the prompts during the import to format the data to your liking.

Nice DMR, didnt know you could do that.


-T

Yeah- old tricks tricks from The Deep Dark Days of DOS :mrgreen:

What surprised me was how well Excel dealt with the imported data from the text file. It sort of fscked header and summary info, but the actual filenames and attributes fall into the rows and columns pretty nicely.

Yeah- old tricks tricks from The Deep Dark Days of DOS :mrgreen:

What surprised me was how well Excel dealt with the imported data from the text file. It sort of fscked header and summary info, but the actual filenames and attributes fall into the rows and columns pretty nicely.

Yes tayspen only DMR can do that

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.