On 25/11/11 16:47, Brett Parker wrote:
OK - so, here we go...
$ find . . ./d space ./d space/c space .jpg;1 ./d space/d space .jpg;1 ./c space ./c space/b space .jpg;1 ./c space/a space .jpg;1 $ find . -type f -name '*.jpg*' -execdir rename 's/\.jpg.*$/.jpg/' {} + $ find . . ./d space ./d space/c space .jpg ./d space/d space .jpg ./c space ./c space/b space .jpg ./c space/a space .jpg $
Now, that looks to work to me... but maybe I'm missing something.
I don't think you are but plainly I am! I've created directories and sub-directories as you did, viz:- find . . ./sub-directory 1 ./sub-directory 1/metadata.opf;1 ./sub-directory 1/Infamous - Ace Atkins.epub;1 ./sub-directory 1/cover.jpg;1 I then ran the command line script as per the above because I did a cut and paste. Here's the result :- find . -type f -name '*.jpg*' -execdir rename 's/\.jpg.*$/.jpg/' {} + [chris@localhost directory 1]$ find . . ./sub-directory 1 ./sub-directory 1/metadata.opf;1 ./sub-directory 1/Infamous - Ace Atkins.epub;1 ./sub-directory 1/cover.jpg;1 I'm going to give up with this as it's really beginning to annoy me. But in time I will take another look at it and see if I can discover why the wretched thing is not working. Can I give a very public thank you to Brett for persevering for so long. I fear I've tested his patience! -- __ __| |_ __ __ .----------------------------------------------. / _/ _` \ V V / | mailto:cdw_alug@the-walker-household.co.uk | \__\__,_|\_/\_/ |______________________________________________|