Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the equivalent of unix find command on windows? I see that the "find" on windows is more like a grep. I am especially interested in the equivalent of "find . -name [filename]".

Many thanks in advance!

share|improve this question
1  
Is something wrong with my answer? Can I improve it? Do you still need help? –  JohannesM Jun 22 '12 at 16:55
    
Sorry, I had lost sight of this thread a while ago. Thanks for your answer and apologies for not accepting it sooner. –  ARV Jun 25 '12 at 9:44
add comment

2 Answers 2

up vote 3 down vote accepted
dir <drive: [drive:]> /s | findstr /i <pattern>

- alternative -

dir /s <drive:>\<pattern>

example

dir c: d: /s | findstr /i example.txt

- alternative -

dir /s c:\example.txt
share|improve this answer
    
dir c: /s example.txt works, too. –  DevSolar Jun 25 '12 at 11:55
    
@DevSolar can you recheck your command? I've tested it on Windows 5.1 Build 2600 SP3, and your command just gives me the list of files in the directory c: –  JohannesM Jun 25 '12 at 12:07
1  
Uh... sorry. Serves me right to type from memory. dir /s C:\example.txt it is. –  DevSolar Jun 25 '12 at 12:14
add comment

The Find-ChildItem Cmdlet in Windows Powershell is an equivalent of Unix/Linux find command

http://windows-powershell-scripts.blogspot.in/2009/08/unix-linux-find-equivalent-in.html

Some of Find-ChildItem Options

  1. Find-ChildItem -Type f -Name ".*.exe"
  2. Find-ChildItem -Type f -Name "\.c$" -Exec "Get-Content {} | Measure-Object -Line -Character -Word"
  3. Find-ChildItem -Type f -Empty
  4. Find-ChildItem -Type f -Empty -OutObject
  5. Find-ChildItem -Type f -Empty -Delete
  6. Find-ChildItem -Type f -Size +9M -Delete
  7. Find-ChildItem -Type d
  8. Find-ChildItem -Type f -Size +50m -WTime +5 -MaxDepth 1 -Delete

Disclaimer: I am the developer of Find-ChildItem cmdlet

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.