How to extract a list of all the files and folders within a Windows OS folder onto Excel

We are working on many files & folder in Windows PC or laptop & there are chances that we may end up adding or deleting files & folders regularly. These files & folders could be very important for us & the other person can edit them without our instruction. This article will help us in keeping track of which file or folder is edited with their respective date, time, size, etc.

In this post, we will learn how to retrieve a list of files in a folder in Excel. We will import all the files and folder details in Excel to keep track of file size, type, and modified date.

To keep track of the recently modified files or folders, excel is a smart option to keep track of important business documents or images. There is not a single step solution that can help us; however, in Windows 7, there is a workaround. With Command Prompt, we can get the list of files having a directory list in a text document & then this text file can be imported in Excel.

We need to follow the below steps:


  • Press “Win + E”shortcut key to open Windows Explorer and locate the folder for which you need a file list (D:\Test Folder in this example)
  • Hold the “Shift” key, right click on the folder and select “Open Command Window Here”




  • This only works with folders & not with libraries. Refer below image




  • Clicking on command window will open Command Prompt




  • Type “dir /b >extractlist.txt” without quotes and press “Enter key”




  • This will create a text file name “extractlist” containing list of all the files stored in “Test Folder”




  • To include file sizes and dates, we will type “dir >extractlist.txt”and press “Enter key”




  • This will open the directory list with all the files name, size & last saved time




  • To include files in sub-directories, type “dir /b /s >extractlist.txt” to create a list of files with the full directory structure




  • This will contain the name of the file in a structured way




  • The next step is to open Microsoft Excel
  • Click on File & Open to bring up the Open dialog window or press “Ctrl-O” shortcut key




  • Select the folder in which the file is saved
  • Click the file type drop-down menu and select “Text Files”




  • Select the “extractlist.txt”& click on Open button
  • Text Import Wizard will be opened




  • Click on Next




  • Click on Finish button




  • Excel file will be imported; refer below image




Following above steps, we can keep a track of last modified date & time, file types, list of files, files size & many more details.


Conclusion: This article will be helpful in organizing files and folders into Excel sheet. This would be really helpful in case any important file or folder gets deleted. The data stored in Excel file will be saved & can help us in restoring the file.


If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook.

We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at


  1. Great tip for extracting text. Note though that Windows 10 defaults to powershell, therefore a command prompt has to be opened from the run command line (or any other way to get to cmd). Powershell does not recognize the command, but it works fine in cmd. Thanks for the tip 100%!

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.