The dot_clean
operations can depend on the file system. I will try to illustrate this through examples. Basicaly, the following will be shown.
- The
find . -type f -iname '._*' -exec rm '{}' \;
command does the same thing as thedot_clean -m --keep=native .
command, which is to remove._*
files. - The
dot_clean -m .
command also removes._*
files, but can also transfer information before removing the files.
Initial Conditions
The ls
command output below shows the contains of four volumes which are formatted as FAT32, APFS, ExFAT and JHFS+. The data fork of the hi.txt
file in each volume is the same. The same is true for the ._bye.txt
and ._hi.txt
files in each volume. All previously existing bye.txt
files have been removed.
davidanderson@Snapper /Volumes % ls -l@OeA /Volumes/MYFAT32 /Volumes/MyAPFS /Volumes/MyExFAT /Volumes/MyJHFS+
/Volumes/MYFAT32:
total 32
-rwxrwxrwx 1 davidanderson staff hidden 4096 Nov 17 17:04 ._bye.txt
-rwxrwxrwx 1 davidanderson staff hidden 4096 Nov 17 17:02 ._hi.txt
drwxrwxrwx 1 davidanderson staff hidden 4096 Nov 17 18:49 .fseventsd
-rwxrwxrwx@ 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
com.apple.TextEncoding 15
com.apple.lastuseddate#PS 16
com.apple.metadata:kMDLabel_df4faouox2jis4jyu5u6pu7qnu 89
/Volumes/MyAPFS:
total 24
-rwxrwxrwx 1 davidanderson staff - 4096 Nov 17 17:04 ._bye.txt
-rwxrwxrwx 1 davidanderson staff - 4096 Nov 17 17:02 ._hi.txt
drwxrwxrwx 7 davidanderson staff - 224 Nov 17 17:17 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
/Volumes/MyExFAT:
total 256
-rwxrwxrwx 1 davidanderson staff hidden 4096 Nov 17 17:04 ._bye.txt
-rwxrwxrwx 1 davidanderson staff hidden 4096 Nov 17 17:02 ._hi.txt
drwxrwxrwx 1 davidanderson staff hidden 32768 Nov 17 18:49 .fseventsd
-rwxrwxrwx@ 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
com.apple.TextEncoding 15
com.apple.lastuseddate#PS 16
com.apple.metadata:kMDLabel_df4faouox2jis4jyu5u6pu7qnu 89
/Volumes/MyJHFS+:
total 24
-rwxrwxrwx 1 davidanderson staff - 4096 Nov 17 17:04 ._bye.txt
-rwxrwxrwx 1 davidanderson staff - 4096 Nov 17 17:02 ._hi.txt
drwxrwxrwx 7 davidanderson staff - 238 Nov 17 17:17 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
Note the following:
- The
hi.txt
file in the FAT32 and ExFAT volumes has extended attributes which are stored in the._hi.txt
file. - The
hi.txt
file in the APFS and JHFS+ volumes has no extended attributes. The extended attributes, which are stored in the._hi.txt
file, are ignored.
Case 1: Use of find . -type f -iname '._*' -exec rm '{}' \;
Below the find . -type f -iname '._*' -exec rm '{}' \;
command was modified to act on the four volumes as given in the Initial Conditions section. The results are shown below.
davidanderson@Snapper /Volumes % find /Volumes/MYFAT32 /Volumes/MyAPFS /Volumes/MyExFAT /Volumes/MyJHFS+ -type f -iname '._*' -exec rm '{}' \;
davidanderson@Snapper /Volumes % ls -l@OeA /Volumes/MYFAT32 /Volumes/MyAPFS /Volumes/MyExFAT /Volumes/MyJHFS+
/Volumes/MYFAT32:
total 16
drwxrwxrwx 1 davidanderson staff hidden 4096 Nov 17 18:49 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
/Volumes/MyAPFS:
total 8
drwxrwxrwx 7 davidanderson staff - 224 Nov 17 17:17 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
/Volumes/MyExFAT:
total 128
drwxrwxrwx 1 davidanderson staff hidden 32768 Nov 17 18:49 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
/Volumes/MyJHFS+:
total 8
drwxrwxrwx 7 davidanderson staff - 238 Nov 17 17:17 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
Note the following:
- All
._*
files have been removed. - None of the
hi.txt
files have extended attributes.
Case 2: Use of dot_clean -m .
Below the dot_clean -m .
command was modified to act on the four volumes as given in the Initial Conditions section. The results are shown below.
davidanderson@Snapper /Volumes % dot_clean -m /Volumes/MYFAT32 /Volum/MyAPFS /Volumes/MyExFAT /Volumes/MyJHFS+
davidanderson@Snapper /Volumes % ls -l@OeA /Volumes/MYFAT32 /Volumes/MyAPFS /Volumes/MyExFAT /Volumes/MyJHFS+
/Volumes/MYFAT32:
total 16
drwxrwxrwx 1 davidanderson staff hidden 4096 Nov 17 19:32 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
/Volumes/MyAPFS:
total 16
drwxrwxrwx 7 davidanderson staff - 224 Nov 17 17:17 .fseventsd
-rwxrwxrwx@ 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
com.apple.ResourceFork 286
com.apple.TextEncoding 15
com.apple.lastuseddate#PS 16
com.apple.metadata:kMDLabel_df4faouox2jis4jyu5u6pu7qnu 89
/Volumes/MyExFAT:
total 128
drwxrwxrwx 1 davidanderson staff hidden 32768 Nov 17 19:32 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
/Volumes/MyJHFS+:
total 16
drwxrwxrwx 7 davidanderson staff - 238 Nov 17 17:17 .fseventsd
-rwxrwxrwx@ 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
com.apple.ResourceFork 286
com.apple.TextEncoding 15
com.apple.lastuseddate#PS 16
com.apple.metadata:kMDLabel_df4faouox2jis4jyu5u6pu7qnu 89
Note the following:
- All
._*
files have been removed. - The
hi.txt
file in the FAT32 and ExFAT volumes has no extended attributes. - The
hi.txt
file in the APFS and JHFS+ volumes has extended attributes. The extended attributes were copied from the._hi.txt
file before the._hi.txt
file was removed.
Case 3: Use of dot_clean -m --keep=native .
Below the dot_clean -m --keep=native .
command was modified to act on the four volumes as given in the Initial Conditions section. The results are shown below.
davidanderson@Snapper /Volumes % dot_clean -m --keep=native /Volumes/MYFAT32 /Volumes/MyAPFS /Volumes/MyExFAT /Volumes/MyJHFS+
davidanderson@Snapper /Volumes % ls -l@OeA /Volumes/MYFAT32 /Volumes/MyAPFS /Volumes/MyExFAT /Volumes/MyJHFS+
/Volumes/MYFAT32:
total 16
drwxrwxrwx 1 davidanderson staff hidden 4096 Nov 17 19:37 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
/Volumes/MyAPFS:
total 8
drwxrwxrwx 7 davidanderson staff - 224 Nov 17 17:17 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
/Volumes/MyExFAT:
total 128
drwxrwxrwx 1 davidanderson staff hidden 32768 Nov 17 19:37 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
/Volumes/MyJHFS+:
total 8
drwxrwxrwx 7 davidanderson staff - 238 Nov 17 17:17 .fseventsd
-rwxrwxrwx 1 davidanderson staff - 10 Nov 17 17:02 hi.txt
Note the following:
- All
._*
files have been removed. - None of the
hi.txt
files have extended attributes. - The results are the same as Case 1.
macOS Catalina version 10.15.7 was used to test this answer.