How to Fix Greyed Out Files and Folders on macOS Finder
Symptoms
Let’s say, for a file (folder as well) with path /path/to/myfile
, it does show up on Finder, but greyed out. The UI seems to suggest either the file is off limit due to permissions, or it’s still copying or downloading. But if you actually open the said file by manually feeding the path, say, opening it from a different app, or a different device, or even opening it on the same machine by Finder by Go > Go to Folder, it opens. No file seems to be damaged.
Solution
On Terminal, run a command like following. Don’t forget direct the path to the file or folder that is greyed out:
SetFile -d "././." "/path/to/myfile"
Afterthoughts
At first I was writing some Python codes to create a list of files that are seemingly damaged. But for the life of me, I couldn’t see what meta data was flagging the file to be ‘greyed out’ by Finder. From Synology forum I found out this is actually Mac’s old copying mechanism in play. When Mac copies a file, the file is copied over first then the creation date (which is set to 1984/1/24 at default) is set afterward. So it appears when Finder sees the exact same creation date again, it assumes the copying is incomplete.
The command sets the creation date to current date. Provided that the problem is rooted on the fact that creation date on the file/folder is set to default, changing it to any random value should work. In theory, one could actually ‘fix’ the date to its original value, or provide an arbitrary value (e.g. 1980/1/1) to flag them to be fixed in the future.