Results 1 to 7 of 7
Hi all,
When i tried the command,
Code:
sudo find / -type f -name *.pdf -exec cp {} . \;
Code:
/usr/bin/find: paths must precede expression
Usage: /usr/bin/find [-H] [-L] ...
- 01-31-2008 #1
Problem with find command
Hi all,
When i tried the command,
Code:sudo find / -type f -name *.pdf -exec cp {} . \;
it worked perfectly few hours back.Code:/usr/bin/find: paths must precede expression Usage: /usr/bin/find [-H] [-L] [-P] [path...] [expression]

what could be the problem? and what's this error mean?- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 01-31-2008 #2
Works fine for me using
Code:find /some/path -type f -name "*.pdf" -exec cp {} . \;
- 01-31-2008 #3
I looks like a issue( bug??) with find command:
now it works when i type
i tried to change pdf to txt - it shows the same error again.Code:sudo find / -type f -name *.pdf -exec cp {} . \;
i get the msgCode:sudo find / -type f -name *.txt -exec cp {} . \;
quite strange!!!Code:/usr/bin/find: paths must precede expression Usage: /usr/bin/find [-H] [-L] [-P] [path...] [expression]
Did you know the meaning of above error?- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 02-01-2008 #4Linux Enthusiast
- Join Date
- Aug 2006
- Location
- Portsmouth, UK
- Posts
- 539
Try retyping the command, I ran into this issue a few days back and it turned out to be a cut 'n' paste issue. Go figure
RHCE #100-015-395
Please don't PM me with questions as no reply may offend, that's what the forums are for.
- 02-01-2008 #5
One thing that is striking me is that you are not quoting your shell patterns (*.pdf, *.txt, etc.). Because they are not quoted, they are expanded by the shell, rather than being passed in to find.
Try quoting them and see if that helps.DISTRO=Arch
Registered Linux User #388732
- 02-01-2008 #6Linux Enthusiast
- Join Date
- Aug 2006
- Location
- Portsmouth, UK
- Posts
- 539
Well spotted Cabhan
, though I don't think it's the cause of the problem (I was quoting the patterns but still had the problem, although I bet it had something todo with cutting a pasting from M$ notepad
)
RHCE #100-015-395
Please don't PM me with questions as no reply may offend, that's what the forums are for.
- 02-04-2008 #7
Yes,Cabhan. It works when put quotes around it like
But works even without quotes.Code:sudo find / -type f -name "*.pdf" -exec ls -l {} \;
Code:sudo find / -type f -name *.jpg -exec ls -l {} \;
Hi matonb,
I tried to cut-n-paste i got the errors and
typed the command at terminal - still i'm getting the errors.
anyway using quotes solves my issue with find
Thanks guyz.- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------


Reply With Quote
