I now have a number of scripts (thanks in great part to this website) that create files and put them on the desktop, which in turn via Automator get moved to folders.
Have been trying to do the same with Calendar "archives, which Calendar exports with names like “Calendars 9.8.23, 11.41 AM.icbu.” Automator, when getting a file off the desktop needs a specific name for the file that it is to move. The exported Calendar archive file name changes by the minute.
So, is there a way with a script to change “Calendars 9.8.23, 11.41 AM.icbu” to something like “Calendars Archive 2023/09/08.icbu”? Why they needed to add the time to the archive name is beyond me.
This seems to work, but still requires that the Calendar given name of “Calendars 9.8.23, 2.11 PM.icbu” still be entered into the script.
tell application "Finder"
set theFile to "Calendars 9.8.23, 2.11 PM.icbu"
set theName to "Test"
set the name of file theFile to theName & ".icbu"
end tell
Is there a "wildcard’ entry as there is in Windows, for example *.icbu?
This works even better:
tell application "Finder"
set theFile to (choose file)
set theName to "Calendar Archive"
set the name of file theFile to theName & ".icbu"
end tell
So now, with the file name “Calendar Archive” I can again use Automator to get the file, add the date to the file name and then move it to the correct folder.
Open to other ideas, but for the most part, think I’ve managed to answer my own question.