16

On mac, I sometimes find a file called Icon^M . The one I have in front of me right now is empty.

Now, I can guess it's probably a file to contain... an icon, most probably the personalized icon for the folder, but why the wacky name with the control-M at the end ?

Chealion
  • 25,408
  • 8
  • 67
  • 75
Stefano Borini
  • 2,294
  • 6
  • 34
  • 49
  • I saw closing votes to migrate to superuser... I am voting it as well. I do believe I posted the question in the wrong place. – Stefano Borini Jan 15 '10 at 06:50
  • 4
    It is empty because all the bits are in the resource fork. `ls -l "$(printf 'Icon\r/..namedfork/rsrc')"` – Chris Johnsen Jan 15 '10 at 07:08
  • 1
    The control-M at the end is to make sure that every time you're copying such a folder to a FAT32 drive you'll get a seemingly random error about a file you've never seen before. Actually, that's probably not the reason, but it is a side effect. – Benjamin Dobson Jan 16 '10 at 00:51

3 Answers3

8

These Icon\r files are still in use on modern MacOS X today. They are generally invisible but sharing tools like Dropbox can cause them to become exposed as the hidden attribute assoicated with them may not be propagated with the file. More information about them can be read in the Icon? file on OS X desktop superuser question.

Anon
  • 81
  • 1
  • 1
4

You're right: According to haxx.se, this filename was the old (OS 9) way to have a personalized icon for a folder.

2

You can temporarily clean them up with: find . -name Icon$'\r' -delete But that isn't a solution.

If it is an older HFS+ file system, you can enter the following in tTerminal to prevent writing Mac junk to the network shares: defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true but that doesn't work with APFS. :(

Why is this not being looked at as a MacOS problem, rather than blaming Google Drive?

I am also encountering this problem with one of our developers (MacOS Catalina). It's driving me bonkers because every file or folder that is created from Mac Finder, while in Google Drive, creates these "Icon/?" files.

Does anyone actually know how to stop this unwanted and anachronistic behavior from happening on APFS?

sdcinvan
  • 21
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 24 '22 at 19:25
  • Google drive doesnt seem to respect resource forks (which these icons are) and copy its data to every copy of the file in every folder, wasting many gigabytes. This is a Google Drive problem on macOS, not a problem macOS have without Google Drive, so blaming Google Drive is correct. – Rodrigo Jan 31 '22 at 17:19