Using Automator to change the creation date of a folder in Mojave I work as a freelance designer and I have set up an automator app to generate a standard folder structure so that source files are kept in source folder, output folders are in output folder etc. all within my ongoing jobs folder
I use labels a lot and so I have a template folder set up that has the labels I need and the workflow duplicates the template structure and puts it into my jobs folder. I find it easier to search on labels as I can drill down into the specifics with saved searches
The issue I have is that the creation date is always the same as when I first set up that folder so I can't do &quot;sort by creation date&quot; to organise the files and date added only seems to work sometimes.
I have found the terminal command &quot;SetFile -d&quot; and I understand I should be able to run a shell script to run that command, which works if I do it manually in the terminal
But I'm stuck on the syntax for the shell script so that runs script has the file I am working on and today's date and time
Does anyone have any idea how I might accomplish this?
I was thinking along the lines of a folder action that changes the creation date of the folder once it is added to the folder
Any help gratefully received
Without seeing what you already have in your Automator workflow the only suggestion I can make is the following example shell script code is how I would set the creation date, to the date/time of execution (or current date/time), on a target folder containing the folders the creation date should be changed for:
find '/path/to/parent/folder' -type d -print0 | xargs -0 -I{} SetFile -d &quot;$(date -j &quot;+%m/%d/%Y %T&quot;)&quot; {}

The example shell script code uses the find command to find all directories within '/path/to/parent/folder', passing a null terminated string (a list of the directories found) to xargs and executes SetFile with the strings as arguments. Thus changing the creation date on the directories (folders).
Obviously '/path/to/parent/folder' will need to be defined, literally or tokenized, and again without seeing what you already have, I'm not going to waste time guessing, to offer variations on the example shell script code.