We like to search many directories in a Windows environment with cygwin.
We tried find . -name *.txt -print
but it complains the -print predicate.
What is the correct command then ?
We only want matched files printed to console.
Thanks all
cygwin;find
We like to search many directories in a Windows environment with cygwin.
We tried find . -name *.txt -print
but it complains the -print predicate.
What is the correct command then ?
We only want matched files printed to console.
Thanks all
Best Answer
It is complaining because you have not quoted the
*.txt
so the shell is expanding the pattern instead of passing it tofind
. In other words, let's say you are in a directory that contains these files:When you say
find . -name *txt -print
the wildcard (*
) is expanded by the shell (bash probably) so what is passed to ffind
is actually:That's too many arguments and
find
complains. To get what you want, you need to quote the pattern you a re searching for (you also don't need the-print
for what you are doing):