Topics Map > SCS Computing > How-To
HOW TO - remove ._ files (AppleDouble) files from a file server
What are dotfiles?
When writing to a non-Mac file system, Macs create a separate file for each file and folder that contains metadata about the file or folder called "AppleDouble" files. These have the same name as the files and folders in a directory, but are prepended with "._". MacOS hides these files, but you will see them on Windows, Linux, or in a Mac Terminal window. They don't do any real harm other than taking up space and making directories look VERY full. They do also take up (a little bit of) space, so getting rid of them can clean up both the look at storage space on a shared drive.
With MacOS 10.5 and later, Apple included a utility called "dot_clean" which will merge the metadata kept in these AppleDouble files with the original file, and then delete the AppleDouble file. For the man page (manual page, or help file) for dot_clean, see https://ss64.com/mac/dot_clean.html or type man dot_clean
in a MacOS terminal window.
Instructions for running dot_clean:
- Press [Shift]-[Command]-[U] to open the "Utilities" folder
- Double-click on the Terminal icon
- Type
cd /volumes
- Type
ls
.- You should see "Macintosh HD" and any other mounted shares.
- IMPORTANT: If you do NOT see the name of the share you want to clean, then you'll need to mount the correct share
- Click anywhere on the desktop
- Press [Command]-[K] to bring up the "Connect to Server" dialog box and connect to the share you want to clean.
- Go back to the terminal window you opened earlier and repeat type
ls
to be sure you see the share there now.
- Assuming that the share you want to clean is mounted, we'll run the command:
dot_clean -m -n -v /volumes/[sharename]
- For explanations of the options selected, see below
Important flags that modify how the script operates:
There are some things you may want to know:
-f
tells the script to run in the specified directory only. WIthout this, the script will run in the specified directory and all subdirectories.-m
forces the script to delete the ._ files after merging their contents with the data file-n
tells the script to delete any ._ file that does not have an associated data file (without this, it ignores orphaned ._ files)-v
prints verbose output, so you can see what is done. You can exlude this if you want- Folder names with spaces: If a subfolder name has spaces, you'll want to put quotes around the entire volume name
Examples:
dot_clean -f -m -n -v /volumes/sharename
- Runs in the specific directory only (no subdirectories)
- Deletes the ._ files after merging them with their associated data file
- Deletes orphaned ._ files
- Uses verbose output
dot_clean -m -n "/volumes/sharename/folder 1"
- Runs in a directory with a space (note the quotes around the name) and all subdirectories
- Deletes the ._ files after merging them with their associated data file
- Deletes orphaned ._ files
- Uses minimal output (no verbose flag)