LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find cp xargs and error unmatched single quote; (http://www.linuxquestions.org/questions/linux-newbie-8/find-cp-xargs-and-error-unmatched-single-quote%3B-925241/)

mythcat 01-23-2012 06:57 AM

find cp xargs and error unmatched single quote;
 
Code:

$ find ~/STIK/PDF/ -name "*.pdf" | xargs -i mv {} ~/STIK/
I try this
Code:

find ~/STIK/ -name "*.pdf" | xargs -i mv {} ~/STIK/PDF/
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option

How is wrong and why first time working well ?

corp769 01-23-2012 07:38 AM

Could you post more verbose output? And have you tried the -0 option like it said? I'm not currently on linux, so I can't fully research this error for you.

mythcat 01-23-2012 10:24 AM

Quote:

Originally Posted by corp769 (Post 4582084)
Could you post more verbose output? And have you tried the -0 option like it said? I'm not currently on linux, so I can't fully research this error for you.

"And have you tried the -0 option like it said?"
Do you don't said anything ... also I try this option , but the output is a string with all files and final error result is:
Code:

File name too long

Cedrik 01-23-2012 10:46 AM

You need to use -print0 option for find in order to use -0 for xargs
(-print0 mean use \0 char as delimiter instead of new lines)

Code:

find ~/STIK/ -name "*.pdf" -print0 | xargs -0 mv {} ~/STIK/PDF/

mythcat 01-23-2012 10:53 AM

Quote:

Originally Posted by Cedrik (Post 4582249)
You need to use -print0 option for find in order to use -0 for xargs
(-print0 mean use \0 char as delimiter instead of new lines)

Code:

find ~/STIK/ -name "*.pdf" -print0 | xargs -0 mv {} ~/STIK/PDF/

Error :
Code:

mv: target `name001.pdf' is not a directory

jthill 01-23-2012 10:58 AM

The xargs option should be -0 -i or -0i

mythcat 01-23-2012 11:11 AM

Quote:

$ find ~/STIK/ -name "*.pdf" -print0 | xargs -0 -i mv {} ~/STIK/PDF/
SOLVE , it's working now ... thank you.


All times are GMT -5. The time now is 12:23 AM.