0

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

  • I am confused, try again. Is that a part of file name? – Ruskes Feb 13 '14 at 19:37
  • i cant explain my self better then this. – mvaneijgen Feb 13 '14 at 19:42
  • great job, it is clear now. – Ruskes Feb 13 '14 at 20:07
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .