Using automator to add date in YYMMDD format.

Hi,


I'm trying to use automator to create a batch program that reads folders (and subfolders) that will add in the current date YYMMDD style to all the filenames in the folder. I found a way to do YYYYMMDD but I don't want that and can't figure out how to get rid of the 20-part of the year. Any help would be much appreciated!

Posted on Aug 14, 2017 3:20 PM

Reply
9 replies

Nov 13, 2017 6:53 AM in response to bgold13

This is possible within Automator, albeit a bit messy.


Use 'Rename Finder Items' action in Automator to add the date in native Automator YYYYMMDD format before the file name.


Use 'Rename Finder Items' action to add an unusual word or string of characters (e.g. 'potato') directly before the file name and newly added date (this will be directly before the '20' in '2017') directly


Use the 'Replace text' function to isolate the unusual word / set of characters followed directly by '20' (e.g. find; 'potato20') and replace it with [leave text box empty] which will delete it, leaving behind only YYMMDD.


Possibly a better way using only Automator, this is what I did anyway.

Aug 15, 2017 5:18 PM in response to bgold13

This is simpler to do in AppleScript.


Use Script Editor.app to save this script as an application, then drop the files/folders on it to have them renamed.


You can edit the script to rename the files in any way you want.


on open of theFiles


-- Executed when files are dropped on the script


set d to current date

set yy to text -2 through -1 of (year of d as text)

set mm to text -2 through -1 of ("0" & (month of d as integer))

set dd to text -2 through -1 of ("0" & (day of d))


set datestring to yy & mm & dd


repeat with aFile in theFiles

tell application "Finder"

set name of aFile to datestring & "_" & (get name of aFile)

end tell

end repeat

end open

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Using automator to add date in YYMMDD format.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.