find command in windows

 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions find command in windows
# 1  
Old 12-30-2009
find command in windows

Dear Experts,

Please tell me what is the equivalent command of

Code:
find . -name "*.txt" -print

which prints the all the text files in all the folders and sub folders in case of unix.
in windows how can i achieve the same output in windows please inform and also
Code:
find . -name "*.txt" -print| while read obj
do
echo $obj
done

in unix , i want to achieve this in windows how it is possible please inform.
# 2  
Old 12-30-2009
The first I know
Code:
dir /s *.txt

You can do basic piping like
Code:
dir /s *.txt | more

You can use a basic loop with labels and a for loop, but anything more than that you are going to need powershell.
But what do I know, this is a Unix forum Smilie

Alternatively you could use uwin or cygwin so you can run some unix commands on a windows platform.

Last edited by Scrutinizer; 12-30-2009 at 02:40 AM..
# 3  
Old 12-30-2009
Without Powershell you can simulate unix "find" and output only the full hierarchial names of files found.

This is a MSDOS Batch file of type ".bat" (e.g. findtxt.bat).

Code:
@echo off
set START="C:\"
for /R %START% %%f in (*.txt) do (echo %%f)

Note: The value of variable "START" can be "." (like in unix "find").



Footnote: Most Windows MSDOS "dir" versions can output the same bare list of filenames.

Code:
dir C:\*.txt /a:-d /b /s


Last edited by methyl; 12-30-2009 at 09:36 AM.. Reason: Replace "dir" with better version
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

find wwn in windows machine ?

Hi guys .. How to can I know the HBA WWN address in the windows machine ? Pls advice with command ... (1 Reply)
Discussion started by: roooooot
1 Replies

2. Infrastructure Monitoring

How to find the duplex speed on Windows

Hi, In UNIX, it's very easy to find the duplex speed. But in Windows, is there a easy way to find the duplex speed? I can't go to over 100 servers to find this out, I was wondering if I run one command to do this? Please advice. (2 Replies)
Discussion started by: samnyc
2 Replies

3. Windows & DOS: Issues & Discussions

how to find running databases in windows

Hi, I am working in solaris os.I would like to know how many databases are running in windows. Is there any command like ps -ef|grep pmon in wndows............... Thanks&Regards, Arul (1 Reply)
Discussion started by: arulkumar
1 Replies

4. Windows & DOS: Issues & Discussions

How to find windows user without any password

How to find windows users without any password.. (0 Replies)
Discussion started by: RPG
0 Replies

5. UNIX for Dummies Questions & Answers

Grub can't find Windows XP

grub was working beautifully on my old hard drive. I cloned my drive, and reinstalled grub. My linux partition loads fine, but when I click on Windows, grub simply sends me back to the grub prompt with no error message. On investigating, it appears that grub hasn't loaded the windows kernel. (I... (2 Replies)
Discussion started by: LeoSimon
2 Replies

6. Windows & DOS: Issues & Discussions

windows howto find

Hi all! How would you do the equivalent of find ! -type f..... under windows? Meaning, how under a directory could you find all files except those named *.mp3 for example? the command under linux would be: find $DIR ! -name "*.mp3" what would be that under windows? Thanx for any ideas... (3 Replies)
Discussion started by: penguin-friend
3 Replies

7. Shell Programming and Scripting

command find returned bash: /usr/bin/find: Argument list too long

Hello, I create a file touch 1201093003 fichcomp and inside a repertory (which hava a lot of files) I want to list all files created before this file : find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies
Login or Register to Ask a Question