question on "find"

I have another question.

"find ./*" displays recursively all files in this and its sub-directories.

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 ?

Thanks.

Thanks Mike and Raju for ur earlier responses.



Tony Gogoi
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Tony Gogoi [ Mo, 19 April 2004 01:47 ] [ ID #64100 ]

Re: question on "find"

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 [at] virgin.net>
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Glynn Clements [ Mo, 19 April 2004 13:15 ] [ ID #64105 ]

Re: question on "find"

The easiest would be to just 'find . '
That tells it to search in the current dirctory (and also
find hidden files in the current directory, which "find *" won't)

I don't see why "Doc - PDF" would cause you
problems, but I can see "-pdf doc" causing a problem,
because the leading '-' makes the filename look like a
find search option (and all other filenames after that
are evaluated in that context).

That can be worked around by using './*' instead of '*'
(replace '*' with any globbing pattern)
This would keep the first character of a filename from
ever being a "-"

Tony Gogoi wrote:
> I have another question.
>
> "find ./*" displays recursively all files in this and its sub-directories.
>
> 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 ?
>
> Thanks.
>
> Thanks Mike and Raju for ur earlier responses.
>
>
>
> Tony Gogoi
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo [at] vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html


--
Stephen Samuel +1(604)876-0426 samuel [at] bcgreen.com
http://www.bcgreen.com/~samuel/
Powerful committed communication. Transformation touching
the jewel within each person and bringing it to light.

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Stephen Samuel [ Mo, 19 April 2004 03:17 ] [ ID #94052 ]
Linux » gmane.linux.admin » question on "find"

Vorheriges Thema: Perl
Nächstes Thema: dos command