On Windows 10, sometimes, you may need to generate a csv file containing the information about a particular folder location for inventory purposes, to determine a specific information, or compare the data against another version of the folder to ensure its integrity.
You could perform this task manually, but it could take a long time. However, you can also use a PowerShell command to speed the process to a few seconds.
In this guide, you’ll learn the steps to use a PowerShell command to create an inventory of the content of a folder on Windows 10.
How to export list of files to csv on Windows 10
To create an Excel file containing files information from a folder with PowerShell, use these steps:
-
Open File Explorer.
-
Navigate to the folder or network location containing the files.
-
Type the following command in the address bar and press Enter:
PowerShell
-
Type the following command to create an Excel supported csv list with a list of all the file names of the current location and press Enter:
Dir | Export-CSV PATH\TO\EXPORTED\FILE.CSV
In the command, make sure to update the path and name of the output file.
For example, this command saves the output to the Desktop folder:
Dir | Export-CSV C:\Users\username\Desktop\FileList.csv
Once you complete the steps, the command will create a csv file containing a lot of information about the contents inside the folder, including name of files, path, dates, and more, which you can then view and edit using Excel.
The command only creates a list of the files and folders within the current location, not subfolders.