I wrote a shell script to change the modification date (using
touch) of a set of directories to be the same as the date of the most recently modified file in the directory. (To make it easier to sort projects by date.)
This works perfectly for directories that are not stored on iCloud. But for iCloud directories, the date is changed and then immediately changes back to today's date.
I tried moving the parent directory out of Documents so it was no longer on iCloud. I ran the script and all the folder modified dates were set correctly. But when I copied it back to Documents, all the dates were reset to the current date/time.
Any suggestions as to why this happens and how to get round it?