til/delete ds_store files

macOS creates .DS_Store files to keep track of custom attributes, such as folder view options, of its containing folder. These files are usually added to .gitignore because it's not a file that we want to version control. But, you might still have a bunch of them littering up your folders. Using the following command, we can remove all of them, recursively, in the current directory.

find . -name '.DS_Store' -type f -delete

And here's what the command does:

  • find . - Find inside the current directory (.)
  • -name '.DS_Store' - Name of the file to search for
  • -type f - Search for a regular file
  • -delete - Delete any files found

Wikipedia. (2022-10-11). .DS_Store. Link