LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-11-2015, 07:44 PM   #1
deepGC
LQ Newbie
 
Registered: May 2015
Posts: 21

Rep: Reputation: Disabled
Problem with cp command


Hi folks,

I'm running a script where a modified mp3 file needs to be copied but I'm getting an error

cp: target `20.05.2015_radio.mp3 _processed/Some DJ - Live @ www.247House.fm 20.05.2015_radio2.mp3' is not a directory

And this is the script:

Code:
cp _processed/${g%.mp3}"_radio.mp3 _processed/${g%%.mp3}"_radio2.mp3
Any ideas? Could it be the spacing in the file name?

Last edited by deepGC; 06-11-2015 at 07:50 PM.
 
Old 06-11-2015, 08:08 PM   #2
ltwilliams58
LQ Newbie
 
Registered: Jun 2015
Distribution: Mint Ubuntu
Posts: 27

Rep: Reputation: 3
You could try something like:

Code:
for i in `_processed/${g%.mp3}"_radio.mp3`; do cp $i `echo $i | sed "s/radio.mp3/radio2.mp3/g"`; done
I haven't tested that, however.
 
Old 06-13-2015, 05:48 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 6,791
Blog Entries: 3

Rep: Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633
Quote:
Originally Posted by deepGC View Post
Could it be the spacing in the file name?
yes, it could.
always enclose in double quotes.

apart from that, you might want to re-post that error message with code tags.
 
Old 06-13-2015, 06:06 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,797

Rep: Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888
probably the rename command will help you
 
Old 06-13-2015, 06:38 AM   #5
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 840

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by deepGC View Post
And this is the script:

Code:
cp _processed/${g%.mp3}"_radio.mp3 _processed/${g%%.mp3}"_radio2.mp3
#                      ^                                ^
The quoting in your command does not make sense to me. You probably meant

Code:
cp "_processed/${g%.mp3}_radio.mp3" "_processed/${g%%.mp3}_radio2.mp3"
#  ^                              ^ ^                                ^
 
Old 06-13-2015, 07:16 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 6,791
Blog Entries: 3

Rep: Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633Reputation: 1633
good catch, millgates.
i didn't even think deep enough to notice that.
 
  


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
at command problem solzoc Linux - Software 1 10-15-2012 10:53 PM
ed command problem moata_u Programming 3 03-23-2011 06:41 PM
problem with auditreduce command and praudit command preetishetty Linux - Security 0 12-03-2007 09:24 AM
A tr command problem baks Programming 10 05-31-2007 08:03 AM
command problem vickr1z Linux - Newbie 3 09-06-2004 01:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:45 AM.

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