Clean Up Google Drive Icon Files

I had a Git repo that I was storing on Google Drive (Yes that probably was not a great idea, but it was a lazy way of sharing some pdfs in the repo with a non-technical coworker). The Google Drive app on the Mac uses an “Icon” file to indicate sync statuses of folders.  Unfortunately this kept screwing up the repo by also putting “Icon” files in all the folders in the .git directory.  Having the repo was more important than it being in Google Drive so I moved the folder out of Google Drive.  Once the folder was moved the “Icon” files remained and the repo was still throwing an error when I tried to code in Adobe Brackets.

Here is how I cleaned up all the Google Drive “Icon” files.

WARNING: BE SURE YOU DON’T HAVE FILES NAMED WITH “Icon” AS THE FIRST 4 LETTERS OR THIS WILL DELETE THEM.

  1. Open terminal
  2. Change directories into the folder that was once in Google Drive
  3. Issue the following terminal command:
    find . -name 'Icon*' -type f -delete

Now the repo is back to normal.

3 thoughts on “Clean Up Google Drive Icon Files”

  1. A little safer perhaps:

    “`
    find . -name ‘Icon?’ -size 0 -type f -delete
    “`
    This restricts it to files with Icon plus one letter and of size 0.

  2. I needed to remove the quotes (the ones around ‘Icon?’ as well as the ones around the whole command):

    find . -name ‘Icon?’ -size 0 -type f -delete

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.