LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-25-2010, 09:17 PM   #1
mrmnemo
Member
 
Registered: Aug 2009
Distribution: linux
Posts: 527

Rep: Reputation: 51
find command problem


i cant seem to figure out why this isnt working.
Code:
find . -name 'Adobe.*' \ -exec sh -c 'exec cp -f "$@" /home/user/tempbook' find-copy {} +
 
Old 03-25-2010, 10:02 PM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 121Reputation: 121
Can I ask what you are trying to do?
 
Old 03-25-2010, 10:19 PM   #3
mrmnemo
Member
 
Registered: Aug 2009
Distribution: linux
Posts: 527

Original Poster
Rep: Reputation: 51
i am trying to move a large amount of files with certain key words in their names to a temp folder to further sort them out. I was able to find a example here
that gave me this :
Code:
find ./Downloads/books/ -type f -iname "A*.*" -print | xargs mv --target-directory=./tempbook/
however, when i ru nit i get:
Code:
mv: cannot stat `(2006).chm': No such file or directory
can you tell what i did wrong? Making the target absolute produces the same error? I dont understand why it tells me that a file name doesnt exist when it was able to find the file name. Is that what happens when you run the above command against symlinks or something?

Last edited by mrmnemo; 03-25-2010 at 10:23 PM.
 
Old 03-25-2010, 10:24 PM   #4
mrmnemo
Member
 
Registered: Aug 2009
Distribution: linux
Posts: 527

Original Poster
Rep: Reputation: 51
correction: i guess i needed to use absolute search and dest paths. now its giving me "mv: missing file operand"
 
Old 03-26-2010, 12:17 AM   #5
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,812

Rep: Reputation: 598Reputation: 598Reputation: 598Reputation: 598Reputation: 598Reputation: 598
Try this:
Code:
find ./Downloads/books/ -type f -iname "A*.*" -exec mv '{}' /path/to/target/directory/
 
1 members found this post helpful.
Old 03-26-2010, 12:30 AM   #6
mrmnemo
Member
 
Registered: Aug 2009
Distribution: linux
Posts: 527

Original Poster
Rep: Reputation: 51
thanks. are the backticks @ '{}' where find pipes out to mv? also is it possible to do omits with find in a pipe like with grep to cull down results?
 
Old 03-26-2010, 12:38 AM   #7
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,812

Rep: Reputation: 598Reputation: 598Reputation: 598Reputation: 598Reputation: 598Reputation: 598
Quote:
Originally Posted by mrmnemo View Post
thanks. are the backticks @ '{}' where find pipes out to mv? also is it possible to do omits with find in a pipe like with grep to cull down results?
They are NOT backticks and AFAIK it is not a pipe. What do you exactly want to omit? Files, directories? Have a look at the man page of find. Look for the options -prune and -regex to filter your results more effectively.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem using find-command Chrizzieej Programming 3 09-30-2008 06:59 AM
problem with find command mrinal.kant Linux - Newbie 4 01-09-2007 04:31 AM
Problem with the #find command jbuckley2004 Linux - General 7 08-26-2005 06:51 PM
problem with the shell command "find zosimus Linux - Software 7 06-14-2005 05:28 PM
problem with find command in script cojo Linux - Software 3 05-26-2004 11:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration