How to Copy a List of Files in a Windows Folder Into an Excel List

Whether it's a folder full of music, photos or documents, there may be times when you would like a list of file names in a directory. While File Explorer lets you view and sort files in folders in a variety of ways, it does not offer a way to generate or export a list to a file or another application. Therefore, if you would like to paste a the structure and file names included with a folder, you'll need to create a special batch file to generate the list first.

Man typing on keyboard
credit: Hemera Technologies/AbleStock.com/Getty Images

Step

Press the "Wind0ws-R" to open a Run dialog box. Type "cmd" in the box and press "Enter" to open a command prompt windows.

Step

Type "cd" at the command prompt, and then press "Enter." Type the full path to the folder that you would like to list, (e.g. "cd c:\users\Maggie\music") and press "Enter."

Step

Type "dir /b > list.txt" at the command prompt window and press "Enter." This command creates a file called "list.txt" in the folder. Close the command prompt window.

Step

Open "list.txt" in Notepad. Each line in the text file is the name of one of the files in the folder you selected.

Step

Click anywhere in the list, and press the "Ctrl-A" to select all the text in the list. Press "Ctrl-C" to copy the text to the Windows Clipboard.

Step

Open Excel. Click in the upper-left cell (A1), and then press "Ctrl-V" to paste the list into the Excel spreadsheet.

Step

Press the "F12" key to bring up the "Save" dialog, and then save the list to the folder of your choice.