Hybris95
Hybris95

Reputation: 2400

Recursive Cmd Dir with Full Path for each line

I'd like to make a recursive dir command on Windows which allows me to have for each line the full path of each file.

Here is the example I'd like to improve with full path of each file instead of just the filename :
dir /S | findstr /R "^.*.xlsm$"

Current output :

01/01/2012  00:01  1 023 456 fileName.xlsm
02/01/2015  01:02  2 345 678 fileName2.xlsm

Expected output :

01/01/2012  00:01  1 023 456 C:\Path\To\File\fileName.xlsm
02/01/2015  01:02  2 345 678 C:\Path\To\Other\File\fileName2.xlsm

Upvotes: 5

Views: 14785

Answers (1)

Hybris95
Hybris95

Reputation: 2400

Thanks to lunacodes I could improve my answer with its path of solution.

Here is the input I produced which helped my case :
for /f "tokens=*" %a in ('dir /s /b') do echo %~za;%~ta;%~fa | findstr /R ".xlsm"

Upvotes: 6

Related Questions