Automator rename finder item date and time

applescriptautomatorfinder

I want to use automator to create a project folder with a Automator service, but i like to add the month and year (with two decimals) not the day, month and whole year.

want i can creatie is item_29022014 but i like to create a file named: 'item_0214' where the first two numbers (02) are the month and the last two numbers (14) are the last to numbers of the current year(2014).

Can i download some add-on for automator? Or do i need a custom script for this?

enter image description here

Best Answer

Check the answer found here

https://apple.stackexchange.com/questions/52535/clean-up-file-names-using-automator

I changed the bash script code to include the date code.

shopt -s extglob
dcode=`date '+%m%y'`
for f in "$@"; do
   f1="${f%.*}"
   f2="${f##*.}"
   if [ "$f2" == "$f1" ] ; then     
       echo "$f" "${f1}_${dcode}"
   else
       echo "$f" "${f1}_${dcode}.${f2}"
   fi
done

The code will should work even with files that do not have extensions.

Replace the commands echo with mv to actually get the code to do anything.

Hope that helped.