Create XLS or CSV from file names in folder on Windows?

8

3

I have a few hundred files in a folder on a Windows 7 machine. Is there a way to generate an XLS, or CSV file from the file names in the folder?

A text file is fine as well; Just looking for any method to automatically extract the file names.

Anagio

Posted 2014-04-22T16:15:05.813

Reputation: 2 518

Answers

11

One very quick and dirty way is the command prompt. Simply open one, navigate to your folder and funnel the result into a text file using this command:

dir > filenames.txt

You will have to do some cleaning up, but as I said "quick and dirty". :-) If you only want certain objects you can of course limit the output of your 'dir' command.

The option Cybertox mentioned might be a good idea:

/B Uses bare format (no heading information or summary).

TheUser1024

Posted 2014-04-22T16:15:05.813

Reputation: 2 823

10dir /b would get you just the filenames – Shazvi – 2014-04-22T16:21:05.907

dir /b - all files ... except hidden files. If you want those, include /a. For more options try dir /? – Adrian Pronk – 2014-04-24T11:15:45.760

19

You can use PowerShell to create an actual CSV file:

dir | Export-Csv MyFileList.csv

Ƭᴇcʜιᴇ007

Posted 2014-04-22T16:15:05.813

Reputation: 103 763

It puts the result in the folder. I would then open it in VS Code using the Excel Viewer extension (this is a much lighter weight way to view Excel and CSV). – yeOldeDataSmythe – 2019-05-08T17:54:25.380

nice thanks, save me a lot of time – Valentin Petkov – 2020-02-06T16:42:33.487

6

This used to work on older Windows versions and gave the full path of all files:

dir /s /b > list.txt

billy

Posted 2014-04-22T16:15:05.813

Reputation: 61

1Assuming you don't want the directory names of the directories each directory contains, use: dir /s /b /a-d > list.txt – Engineer – 2014-04-23T01:09:45.597

0

If you also want the metadata (owner, size, modified date), see PowerShell command to write directory to CSV for a one-liner

Andrew

Posted 2014-04-22T16:15:05.813

Reputation: 139