Re: question on "find"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tony Gogoi wrote:

> I have another question.
> 
> "find ./*" displays recursively all files in this and its sub-directories.

Not quite. "find ." will do that; "find ./*" is equivalent to running
find with all of the files and directories which don't start with a
dot as arguments.

On Unix, wildcards such as "?" and "*" are expanded by the shell. E.g. 
the the current directory contains files named "foo", "bar" and "baz",
then "<command> *" is equivalent to "<command> foo bar baz",
regardless of what <command> actually is.

This is why e.g. "mv *.cxx *.cpp" doesn't work like "ren *.cxx *.cpp"
does under DOS. The command only gets to see the expanded list of
arguments, not the wildcards.

If you want to pass wildcards to a command, you have to use quotes,
e.g.:

	find . -type f -name '*.txt'

> However for some files that were ftp'ed from a Windows system eg.
> something like in the one of the directories
> "(Doc - PDF) My Document.pdf"
> would cause "find *" to display "invalid predicate...." .
> How can I overcome this problem ?

Just use "find .".

-- 
Glynn Clements <glynn.clements@xxxxxxxxxx>
-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux