[SOLVED] Copy and rename files

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

[SOLVED] Copy and rename files

Postby FranBlakes » Tue Sep 17, 2013 10:55 am

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)
Last edited by FranBlakes on Tue Sep 17, 2013 11:51 am, edited 1 time in total.
Ubuntu 10.04.4 LTS!
User avatar
FranBlakes
 
Posts: 96
Joined: Wed Dec 01, 2010 9:16 pm
Location: Worcs.

Postby nelz » Tue Sep 17, 2013 11:08 am

Code: Select all
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)
User avatar
nelz
Site admin
 
Posts: 8498
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby FranBlakes » Tue Sep 17, 2013 11:46 am

Thank you Nelz
Ubuntu 10.04.4 LTS!
User avatar
FranBlakes
 
Posts: 96
Joined: Wed Dec 01, 2010 9:16 pm
Location: Worcs.


Return to Help!

Who is online

Users browsing this forum: nelz and 0 guests