Automator fails on trigger creation date

Hello, maybe someone can prove (or not) the following behavior in automator app:

I made a folder action attached to the Download folder to mark downloaded files from a specified time ago with a tag. It works - lets say - in parts. To get the files I chose the creation date as filter. Automator pick not only all old files but also some just downloaded files as well. Referring the creation date I thought it mean date/time the file was downloaded but this might not be reliable. As a test I downloaded the daily google search form picture and it was tagged…

Any tip will be appreciated.

have you tried having Hazel monitor the folder? “date added” would be the trigger needed. I don’t know whether automator is your best option here. (but might be wrong)

1 Like

I would definitely use Hazel for this too.

Thank you for suggesting hazel. Yes, this solves the task to do.

But I‘m also interested because Automator seems to be broken when using the file creation date finder app shows (and which is correct).

Automator is not broken, I think you are using the wrong filter.

The reason is that the creation date of the file is not the same as the download date. The site where you downloaded the file from could have made this file two years ago, so the file has that date as creation date.

In Finder there is also possibility to sort on Date Added.

23

I don’t know Automator well enough to know if you can use that as a filter.

2 Likes

@FrankV has hit the nail on the head here.

The reason is that the creation date of the file is not the same as the download date. The site where you downloaded the file from could have made this file two years ago, so the file has that date as creation date.

The one thing that I’d add is that the reason you’re only sometimes getting this tag on newly downloaded files is that when it comes to metadata, like the file creation date, moving files over the internet is kind of a crapshoot. Depending on what mechanism you use and where you download the file from sometimes you’ll get the metadata and sometimes you won’t. If you don’t get the metadata, the file creation date will be the same as the download date. If you do get the metadata, the file creation date may not match when you downloaded it.

1 Like

@FrankV @ChrisUpchurch thank you both for clarifying this to me. Unfortunately automator does not have the Added Date trigger. But I found a nice script to read out the Added Date. If I will get it to work I will post it here for reference. In practice I will stick to hazel.

1 Like

After tinkering around with “mdls kMDItemDateAdded” in several variations I don’t get it to work as a folder action.

To constat the obvious: Automator app is not suitable for all types of automation.

The nice thing about Automator is that you can also use code snippets from Shell scripts, AppleScript and other languages (like Python) to do a task.

This is an example of an AppleScript, combined with Shell Script, that you can use in Automater. It gives you the DateAdded in the format yyyymmdd

Add the below to a “Run AppleScript” action.

on run {input, parameters}
set FileDetails to (the POSIX path of input)
set FileDate to do shell script "mdls -name kMDItemDateAdded " & FileDetails & " | awk '{print $3}'|sed -e 's#-##g' "
return FileDate
end run

I guess it can also be a Shell Script action only, but I’m more familiar with AppleScript.

1 Like

Over the years, I’ve found that it’s easier to troubleshoot Hazel than it is to troubleshoot Folder Actions. Sometimes I’ve spent hours trying to tweak Folder Actions so they work the way I want them to.

1 Like