This was faster than building the query, but it's a bit hacky:
First you have to find your firefox user profile's downloads database, mine was here: /Users/MYUSERNAME/Library/Application Support/Firefox/Profiles/NUMBERSandDIGITS.default/downloads.sqlite
Then a rule:
- Code: Select all
if (all) of the following conditions are met for (the file or folder being processed):
<Distinguish Firefox Downloads However You Want To>
Source URL is Blank
Do the following to the matched file or folder:
Run Embedded Script
Embedded Script:
- Code: Select all
WhereFroms=$(/usr/bin/sqlite3 "/Users/MYUSERNAME/Library/Application Support/Firefox/Profiles/NUMBERSandDIGITS.default/downloads.sqlite" .dump | grep -i "$(basename "$1")" | awk -F "," '{print $3}' | sed "s/'//g")
xattr -w com.apple.metadata:kMDItemWhereFroms "(\"$WhereFroms\")" "$1"
EDIT - Array format added for WhereFroms