LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-23-2012, 06:57 AM   #1
mythcat
Member
 
Registered: Dec 2007
Location: Bucharest
Distribution: Debian;Fedora
Posts: 63

Rep: Reputation: 15
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 ?
 
Old 01-23-2012, 07:38 AM   #2
corp769
Guru
 
Registered: Apr 2005
Posts: 5,807

Rep: Reputation: 996Reputation: 996Reputation: 996Reputation: 996Reputation: 996Reputation: 996Reputation: 996Reputation: 996
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.
 
Old 01-23-2012, 10:24 AM   #3
mythcat
Member
 
Registered: Dec 2007
Location: Bucharest
Distribution: Debian;Fedora
Posts: 63

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by corp769 View Post
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
 
Old 01-23-2012, 10:46 AM   #4
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
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/
 
Old 01-23-2012, 10:53 AM   #5
mythcat
Member
 
Registered: Dec 2007
Location: Bucharest
Distribution: Debian;Fedora
Posts: 63

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Cedrik View Post
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
 
Old 01-23-2012, 10:58 AM   #6
jthill
Member
 
Registered: Mar 2010
Distribution: Arch
Posts: 209

Rep: Reputation: 65
The xargs option should be -0 -i or -0i
 
1 members found this post helpful.
Old 01-23-2012, 11:11 AM   #7
mythcat
Member
 
Registered: Dec 2007
Location: Bucharest
Distribution: Debian;Fedora
Posts: 63

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


Reply

Tags
errors, find, xargs


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
[SOLVED] How to pass a single quote inside of a single quote... trist007 Linux - Newbie 2 02-09-2011 07:07 PM
Xargs: Missing quote mellowjen Programming 5 02-27-2007 05:29 PM
xargs: unmatched single quote akudewan Linux - Newbie 4 02-14-2005 05:48 AM
error with find . | xargs cbonar Linux - Newbie 7 12-09-2004 11:22 AM
xargs: unmatched single quote fillatre Linux - Software 2 06-05-2004 10:04 PM


All times are GMT -5. The time now is 08:53 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration