Dir folders at a certain folder depth in a batch file

batchcmd.exedir

I want, with a batch file, to be able to search and display the files in a bunch of folders called "error" located in a bunch of different places.

The error folder is always at the same folder depth but the folder names befor them is different.

dir /A-d /b C:\Temp\*random_folder_name*\*random_folder_name*\error

So, can I create a line that displays all the files in all the error folders, two folders "below", in this example "C:\Temp"? or do I have to add one dir line for every error-folder?

Best Answer

Windows 7 and later have power shell:

You can try:

Get-ChildItem \*\*\*

This returns all items with a depth of two subfolders. Adding * adds an additional subfolder to search in.

Source: https://stackoverflow.com/questions/13249085/limit-get-childitem-recursion-depth

Related Question