LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 06: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 06:50 PM.
 
Old 06-11-2015, 07:08 PM   #2
ltwilliams58
LQ Newbie
 
Registered: Jun 2015
Distribution: Mint Ubuntu
Posts: 29

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, 04:48 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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, 05:06 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,629

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

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
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, 06:16 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

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

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

All times are GMT -5. The time now is 10:28 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
Open Source Consulting | Domain Registration