Others

List Subfolders and Find Files by Path in Windows

Algirdas JasaitisAlgirdas Jasaitis Nov 18, 2026 869 views

Question details

List files and subfolders beneath a parent folder with their full paths, and identify the folder containing a specific file.

List Subfolders and Find Files by Path in Windows
Product
Windows Command Prompt and Microsoft Excel Power Query
Device & OS
Windows
Scenario
A user wants to inventory a folder tree and locate a file without opening each subfolder manually.
Observed behavior
The desired result is a searchable list of full paths or a filtered table showing the file name and its folder path.
Before you start

Copy the full path of the parent folder from File Explorer's address bar. Make sure you have permission to access the folders you want to search.

Solution 1Recommended

List full paths with Windows Command Prompt

Use this method to create a searchable text list of files and subfolders.

1
Open Command Prompt

Open the Start menu, search for Command Prompt, and select it.

2
Run the directory command

Enter dir /s /b "C:\Your\Parent\Folder" > "%USERPROFILE%\FileList.txt", replacing C:\Your\Parent\Folder with your parent folder path. Press Enter.

3
Find the file

In File Explorer, enter %USERPROFILE% in the address bar and open FileList.txt in Notepad. Press Ctrl+F and search for the file name; its full path shows the containing folder.

List full paths with Windows Command Prompt
Listing limits: The command lists accessible files and subfolders recursively. Hidden and system items are excluded by default; add /a to include them. Access errors appear in Command Prompt rather than in the output file.
Free Microsoft Office alternative

Review File Lists in WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format compatibility for an easy transition. Use WPS Spreadsheets to review a file list after creating or importing it; WPS does not replace the Windows directory command or Excel's Power Query folder connector.

Review and search imported file path lists in WPS SpreadsheetsOpen and edit Microsoft Excel XLSX and XLS filesWork with a familiar spreadsheet interfaceUse a free, lightweight Office suite
microsoft office alternative - wps office

Frequently Asked Questions

How do I find which folder contains a file in the text list?

Open FileList.txt in Notepad, press Ctrl+F, and search for the file name. The folder path appears before the file name in each matching full path.

How can I include hidden and system items in the Command Prompt list?

Add /a to the command: dir /s /b /a "C:\Your\Parent\Folder" > "%USERPROFILE%\FileList.txt". You still need permission to access the folders.

Does Excel's From Folder connector list empty subfolders?

No. Data > Get Data > From File > From Folder returns files and their folder paths, rather than a separate list of empty subfolders.

What if multiple files have the same name?

In Notepad, use Ctrl+F to move through the matches and compare their full paths. In Power Query, filter the Name column and check the Folder Path column for each result.