Thanks for that, I did run that in the bin folder and I've have got a lil bit further but...
After all the above is done and I unlock the de-renamer file, I then CD to my folder that has my images and type: de-renamer funkyevent and I get back: ls: [0-9][0-9][0-9][0-9]: No such file or directory
:( There are about 20 images in there, and they even show up when I type ls in terminal. Any idea's? :)
Quote:There are about 20 images in there, and they even show up when I type ls in terminal.
Ah .. you couldn't have given me the correct name.. it is looking for a file that is ONLY numbers, I see you say "images" .. so it will have an extension (like .jpg or .gif) ..
Give me a better example and I will show you what to alter to make it work.
Oh, my apologise's for not making myself clear...
Its images files and they are named as : dscf0264.jpg, dscf0265.jpg, dscf0266.jpg etc :)But if I can, I want to re-number them to a date and chosen file name, then order them in number order. So like I want the final result to look like: 07052006_whatever_001.jpg, 07052006_whatever_002.jpg, 07052006_whatever_003. jpg etc :)
Quote:Oh, my apologise's for not making myself clear...
Its images files and they are named as : dscf0264.jpg, dscf0265.jpg, dscf0266.jpg etc :)But if I can, I want to re-number them to a date and chosen file name, then order them in number order. So like I want the final result to look like: 07052006_whatever_001.jpg, 07052006_whatever_002.jpg, 07052006_whatever_003. jpg etc :)
OK! reworking what i had
Code:
#!/bin/sh
if [ $# -ne 1 ]
then
echo "$0 event"
exit
fi
date=`date +%d%m%Y` #DDMMYYYY
event=$1
# DSCF0000.JPG variants of filenames accepted
# dscf0000.jpg
for p in `ls {dscf,DSCF}[0-9][0-9][0-9][0-9].{jpg,JPG}`
do
numbers=`echo $p | sed 's/^dscf//i'`
mv -i $p ${date}_${event}_${file}.jpg
done
Ok, I switch the date style... and added the ability to see the files you want.. :)
Should do it now.. fingers crossed ;)
Oh .. renumber! I didn't do that .. er we can do that too :P (it is just using the existing numbers)
The above stuff .. does
1233 -> 1233 it will not renumber it .. so
. this is the same thing .. but this time renumbering too!
Code:
#!/bin/sh
if [ $# -ne 1 ]
then
echo "$0 event"
exit
fi
date=`date +%d%m%Y`
event=$1
start=1
for p in `ls {dscf,DSCF}[0-9][0-9][0-9][0-9].{jpg,JPG}`
do
file=`printf "%03u" $num`
mv -i $p ${date}_${event}_${file}.jpg
let "num = num + 1"
done
:):):):):)
BINGO!!
:):):):):):):)
Finally worked! YAY! I'm so pleased! Your a genius!!! :):D:D I used the bottom code as I want them in number order. THANKS AGAIN, your a star!!! :)
Made my head spin a bit, I got there in the end tho :)