Find file recursively under Windows (dir /s not suitable)

5

1

I need find a file in Windows under command line, but receive results as a table. Similar to windowed version of find, where we have last column, displaying location.

dir /s doesn't match this requirement, because it enters each directory and reports this in separate header, leaving file list as usual.

Dims

Posted 2017-02-17T11:23:23.437

Reputation: 8 464

Probably not possible using the command line. You could build something using PowerShell. – Seth – 2017-02-17T11:30:46.463

Would this do: Get-ChildItem -ErrorAction SilentlyContinue -Recurse c:\ -Filter "filetosearch.exe" | select Directory – HelpingHand – 2017-02-17T13:40:55.227

1Maybe: Get-ChildItem -ErrorAction SilentlyContinue -Recurse c:\ -Filter "filetosearch.exe" | select Directory,Name,LastWriteTime | format-table etc... – HelpingHand – 2017-02-17T13:47:24.080

How about DIR /A-D /B /S would that suffice for the need? – Pimp Juice IT – 2017-02-17T13:48:45.187

Answers

8

If the headers are the only problem in your case, use the /B switch.

dir filename.ext /S /B

A list of all files matching the filename along with their location is printed.

Pradeep

Posted 2017-02-17T11:23:23.437

Reputation: 81

5

You can use where.exe

where /r c:\windows ntoskrnl.exe

Axel Rietschin

Posted 2017-02-17T11:23:23.437

Reputation: 151

0

dir filename.* /S /B

Finds all the matches for the string filename. Displays src and include files

user1090885

Posted 2017-02-17T11:23:23.437

Reputation: 1

1Can you explain why you think that answers the question? – RalfFriedl – 2019-09-17T05:18:46.453

Duplicate of answer given over a year ago by @Pradeep, above – RufusVS – 2019-12-17T22:46:46.243