removing ._* files from multiple folders

Ok. On my IMac 27 inch Late 2015 Running Monterey 12.7.1, Everytime I copy any files to a Thumb Drive or an SD card, The each file creates a ._* file counterpart.

I know how to remove them one folder at a time. I need to figure out how to remove them by multiple batches of folders.



iMac 27″, macOS 12.7

Posted on Dec 13, 2023 12:11 PM

Reply
Question marked as Top-ranking reply

Posted on Dec 13, 2023 12:51 PM

I believe the dot_clean -m command will recursively remove them. (If you do a man dot_clean, the description says that you have to give it a -f flag to prevent it from recursively removing these files.)


So if you go into Terminal, and

  • Type dot_clean -m and a space (no RETURN)
  • Drag-and-drop the USB drive's icon from the Desktop to Terminal (to type in its top-level directory name)
  • Press RETURN (to enter the command)

That should recursively remove the files.


After that you should eject the USB drive right away before the Finder decides to write more.


You could probably also incorporate the dot_clean -m command into an Automator application or folder action so that you didn't have to go into Terminal and manually type the command at all.


Similar questions

2 replies
Question marked as Top-ranking reply

Dec 13, 2023 12:51 PM in response to Deadairbrusher

I believe the dot_clean -m command will recursively remove them. (If you do a man dot_clean, the description says that you have to give it a -f flag to prevent it from recursively removing these files.)


So if you go into Terminal, and

  • Type dot_clean -m and a space (no RETURN)
  • Drag-and-drop the USB drive's icon from the Desktop to Terminal (to type in its top-level directory name)
  • Press RETURN (to enter the command)

That should recursively remove the files.


After that you should eject the USB drive right away before the Finder decides to write more.


You could probably also incorporate the dot_clean -m command into an Automator application or folder action so that you didn't have to go into Terminal and manually type the command at all.


Dec 13, 2023 12:53 PM in response to Deadairbrusher

This is a job for the Terminal application and the dot_clean(1) command.


Let's say your thumb drive (FAT32, exFAT) has several folders (not a hierarchy of folders) on it and arbitrarily they are A, B, C, etc. The following command in the Terminal will remove the ._ files on the thumb drive and in the A, B, and C folders on that thumb drive. The dot_clean command does not have a recursive switch to handle sub-folders in A, B, or C.


/usr/sbin/dot_clean -m /Volumes/DRIVENAME /Volumes/DRIVENAME/{A,B,C}


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

removing ._* files from multiple folders

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.