Hi Steve,

On 15 May 2024, at 20:18, Steven M. Bellovin wrote:

Is there any rational way to copy every message in a smart folder to a single zip file, preserving the date order? If I cmd-C the list of messages and copy/paste the files somewhere (or do the same via the command line), the order is quasi-random, not preserving dates. (I'm perfectly happy to do any sort of weird stuff from the command line.)

        —Steve Bellovin, https://www.cs.columbia.edu/~smb

This worked for me in fish shell. Copy the files, then execute this to do some translations on the “content created” field and save it back to the “date created” field.

```
for file in *.eml
    set created (mdls -name kMDItemContentCreationDate -raw "$file" )
set translated (date -jf "%Y-%m-%d %H:%M:%S %z" "$created" "+%Y-%m-%d %I:%M:%S %p" | sed 's/\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\([0-9]\{2\}\).*$/\2\/\3\/\1 \4:\5:\6/')
    SetFile -d "$translated" "$file"
end
```

--
Logan Kirkland
lo...@logankirk.land
_______________________________________________
mailmate mailing list
Unsubscribe: https://lists.freron.com/listinfo/mailmate

Reply via email to