A C utility to recursively remove .DS_Store and AppleDouble files from your system.
rmds is a powerful and flexible command-line utility designed to clean up metadata clutter. While primarily focused on recursively removing .DS_Store files, it also supports targeting AppleDouble (._*) files and any other recurring junk files through custom naming and pattern modes. This is particularly useful for cleaning up macOS metadata files before sharing directories or committing to version control systems that aren't configured to ignore them.
AppleDouble is a file format used by macOS to store file metadata (like extended attributes and resource forks) on file systems that don't natively support them (such as FAT32, ExFAT, or network drives).
When a file is copied to such a system, macOS creates a companion file prepended with ._. For example, a file named image.png will have a corresponding metadata file named ._image.png. While these files are vital for preserving macOS-specific features, they often appear as "junk" files on other operating systems or in version control.
- Recursive Scanning: Traverses subdirectories automatically.
- Safe Deletion: Only targets files exactly named
.DS_Store. - Flexible Modes:
- Clean All: Target both
.DS_Storeand._*AppleDouble files. - Dry Run: Preview deletions without making changes.
- Interactive: Confirm each deletion manually.
- Quiet: Suppress non-essential output.
- Verbose: See which directories are being scanned.
- Clean All: Target both
- Fast and Lightweight: Written in pure C with minimal dependencies.
- A C compiler (like
gccorclang) make(optional, for easier building)
You can build the project using the provided Makefile:
makeAlternatively, compile directly with gcc:
gcc -o rmds rmds.c./rmds [options] [start_path]| Flag | Long Flag | Description |
|---|---|---|
-A |
--clean-all |
Remove both .DS_Store and ._* (AppleDouble) files. |
-n |
--dry-run |
Show what would be deleted without actually deleting. |
-q |
--quiet |
Suppress all output except errors. |
-v |
--verbose |
Display directories as they are scanned. |
-i |
--interactive |
Prompt for confirmation before deleting each file. |
-d |
--max-depth <N> |
Only scan directories at most N levels deep. |
-x |
--one-file-system |
Do not traverse directories on different filesystems. |
-e |
--exclude <DIR> |
Exclude directory name from scan (can be used multiple times). |
-m |
--name <NAME> |
Target filename to delete (defaults to .DS_Store). |
-h |
--help |
Display the help menu. |
Clean a specific directory (dry run):
./rmds -n /path/to/directoryClean all metadata files (including AppleDouble ._* files):
./rmds -A /path/to/external/drivePreview cleaning all metadata (dry run):
./rmds -nA /path/to/external/driveClean multiple directories quietly:
./rmds -q dir1 dir2 dir3Ignore specific directories (e.g., .git and node_modules):
./rmds -e .git -e node_modules /path/to/projectTarget a different file name:
./rmds -m "Thumbs.db" /path/to/directoryInteractive clean with verbose output:
./rmds -iv /path/to/projectCaution
Deletion is permanent. Ensure you have the necessary permissions and have backed up important data if you are unsure.
rmds is written in standard C and uses POSIX-compliant headers. It is fully compatible with:
- macOS: Native environment; handles TCC/permission errors gracefully.
- Linux: Works perfectly on any distribution (Ubuntu, Debian, Fedora, etc.).
- Windows (WSL): Compatible through the Windows Subsystem for Linux.
This project is licensed under the 3-Clause BSD License. See the LICENSE file for the full license text.
Copyright (c) 2026, Vlad Shurupov. All rights reserved.