Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[SOLVED] Copy and rename files

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help!
View previous topic :: View next topic  
Author Message
FranBlakes



Joined: Wed Dec 01, 2010 9:16 pm
Posts: 94
Location: Worcs.

PostPosted: Tue Sep 17, 2013 11:55 am    Post subject: [SOLVED] Copy and rename files Reply with quote

How do I copy yet remove "-poster" from file names?

for example:
I want to copy -
"Ace Ventura - Pet Detective-poster.jpg" to
"Ace Ventura - Pet Detective.jpg"

I have XBMC which reads the "-poster" file but another player where the picture has to be the same as the video file.

Thanks in advance
(Hope it makes sense)
_________________
Ubuntu 10.04.4 LTS!


Last edited by FranBlakes on Tue Sep 17, 2013 12:51 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8455
Location: Warrington, UK

PostPosted: Tue Sep 17, 2013 12:08 pm    Post subject: Reply with quote

Code:
for i in *-poster.jpg
do
  cp "$i" "${i%-poster.jpg}.jpg"
done

_________________
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
Back to top
View user's profile Send private message
FranBlakes



Joined: Wed Dec 01, 2010 9:16 pm
Posts: 94
Location: Worcs.

PostPosted: Tue Sep 17, 2013 12:46 pm    Post subject: Reply with quote

Thank you Nelz
_________________
Ubuntu 10.04.4 LTS!
Back to top
View user's profile Send private message Send e-mail
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help! All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast