Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Misc
Reload this Page Problem with find command
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Misc Any questions or Linux discussion that does not fit in any of the other technical areas.

Reply
 
Thread Tools Display Modes
Old 01-31-2008   #1 (permalink)
Lakshmipathi
Linux Enthusiast
 
Lakshmipathi's Avatar
 
Join Date: Sep 2006
Location: 3rd rock from sun
Posts: 532
Question Problem with find command

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] [-P] [path...] [expression]
it worked perfectly few hours back.
what could be the problem? and what's this error mean?
__________________
- LakshmiPathi.G
------------------------------
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
------------------------------
My OpenSource Projects:
giis
exthide
ext3carve
Lakshmipathi is offline   Reply With Quote
Old 01-31-2008   #2 (permalink)
daark.child
Linux Guru
 
daark.child's Avatar
 
Join Date: Apr 2006
Location: South Yorks, UK
Posts: 3,410
Works fine for me using
Code:
find /some/path -type f -name "*.pdf" -exec cp {} . \;
daark.child is offline   Reply With Quote
Old 01-31-2008   #3 (permalink)
Lakshmipathi
Linux Enthusiast
 
Lakshmipathi's Avatar
 
Join Date: Sep 2006
Location: 3rd rock from sun
Posts: 532
Post

I looks like a issue( bug??) with find command:

now it works when i type
Code:
sudo find / -type f -name *.pdf -exec cp {} . \;
i tried to change pdf to txt - it shows the same error again.
Code:
 sudo find / -type f -name *.txt -exec cp {} . \;
i get the msg

Code:
/usr/bin/find: paths must precede expression
Usage: /usr/bin/find [-H] [-L] [-P] [path...] [expression]
quite strange!!!
Did you know the meaning of above error?
__________________
- LakshmiPathi.G
------------------------------
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
------------------------------
My OpenSource Projects:
giis
exthide
ext3carve
Lakshmipathi is offline   Reply With Quote
Old 02-01-2008   #4 (permalink)
matonb
Linux User
 
Join Date: Aug 2006
Location: Portsmouth, UK
Posts: 348
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 #805007238628267
matonb is offline   Reply With Quote
Old 02-01-2008   #5 (permalink)
Cabhan
Linux Guru
 
Cabhan's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA, USA
Posts: 2,409
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=Gentoo
Registered Linux User #388732
Gentoo Linux, 410 GB HD, 1.2 GB RAM, Fluxbox, These are a Few of my Favorite Things
Cabhan is offline   Reply With Quote
Old 02-01-2008   #6 (permalink)
matonb
Linux User
 
Join Date: Aug 2006
Location: Portsmouth, UK
Posts: 348
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 #805007238628267
matonb is offline   Reply With Quote
Old 02-04-2008   #7 (permalink)
Lakshmipathi
Linux Enthusiast
 
Lakshmipathi's Avatar
 
Join Date: Sep 2006
Location: 3rd rock from sun
Posts: 532
Smile

Yes,Cabhan. It works when put quotes around it like
Code:
sudo find / -type f -name "*.pdf" -exec ls -l {} \;
But works even without quotes.
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
------------------------------
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
------------------------------
My OpenSource Projects:
giis
exthide
ext3carve
Lakshmipathi is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
about mail service jhn_daz Redhat / Fedora Linux Help 21 07-17-2007 02:34 PM
problem with find command mrinal.kant Linux Newbie 1 01-09-2007 07:41 AM
Find command | Grep command error on FC4 vsolank1 Redhat / Fedora Linux Help 5 07-20-2005 08:54 PM
Problem with Docbook-xml-dtd jessdog Gentoo Linux Help 8 06-11-2005 04:57 PM
Command Line Hisory problem larrys Redhat / Fedora Linux Help 3 01-14-2005 06:12 PM




All times are GMT. The time now is 09:45 AM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.0.0