Deleting 'DS_Store' files recursively

Category: unix, year: 2020

MacOS uses additional hidden .DS_Store files in directories to store additional metadata about the directory which is only specific to MacOS.

Unfortunately, by default, many file synchronisation tools (rsync, syncthing) by default synchronise these files to other non-MacOS systems (although it is possible to manually configure them to ignore specific filename patterns), which can be annoying.

The following UNIX (should work on GNU/Linux, MacOS probably other platforms) find command will recursively find files with that filename starting in the current directory, and both print the name of the found files out to stdout and delete them:

find . -name ".DS_Store" -type f -print -delete



Archive
Full Index

linux (4)
cpp (3)
rust (2)
macos (1)
matplotlib (1)
unix (1)


Tags List