In Mac OS X / macOS you can select a file in the Finder, click Informations then click the icon, and paste any image/icon that is in the clipboard. Now this file has a custom icon made of this image.
To remove it, the usual way is to select the file, click Informations, select the custom icon then hit delete and it removes the custom icon, restoring the default one.
Is there a way to remove these custom icons from these files without having to open a Finder window? For example with a Terminal command?
A file has a corrupted custom icon, opening the Finder in this folder causes the Finder to beachball and the HDD to freak out. But I still can access the folder content, and this file, from the command line, if I don't first open a Finder window. So I'm thinking that I "just" need to access the metadata differently to remove the custom icon.