Follow these steps to export a listing of all the files in a directory into an Excel spreadsheet.
There are many occasions when it would be handy to track important documents, images and other files in an Excel spreadsheet. Unfortunately, Microsoft does not offer a simple, one-step way to export a file list from Windows Explorer into Excel. However, there are a couple of fairly easy workarounds in Windows 7.
Workaround # 1
Open Windows Explorer and navigate to the folder containing the files you want to list. From the View dialog select “List” or “Details.” Select all files and folders by typing Ctrl-A. Hold down the Shift key and right-click the folder. Select “Copy as Path” – the file names with the full directory structure will be copied to the clipboard. Open an Excel spreadsheet and select Paste. You now have a spreadsheet with a list of the files with the full directory structure.
The second workaround requires a few more steps but gives you more flexibility. Open Windows Explorer and navigate to the folder containing the files you want to list. Hold down the Shift key and right-click the folder. Select “Open Command Window Here.” This will open up a separate window with a command prompt.
Type “dir /b > filelist.txt” (without the quotation marks) at the command prompt and press Enter. This creates a text file called “filelist.txt” listing the file names only. If you want to include files sizes dates, type “dir > filelist.txt” (again, without the quotation marks). To also include files in sub-directories, type “dir /b /s > filelist.txt” (without the quotation marks) — the file names will include the full directory structure.
Launch Microsoft Excel and select File -> Open. In the file type drop-down menu, select “Text files (*.prn, *.txt, *.cvs).” Navigate to filelist.txt and open it. This will launch the Text Import Wizard window. Click “Finish” to use the default options. You now have a spreadsheet containing the file names and other details depending upon the options you selected.