Announcement: Upgrade to macOS Mojave

With features like Dark Mode, Stacks, and four new built-in apps, macOS Mojave helps you get more out of every click. 
Find out how to upgrade to macOS Mojave > https://support.apple.com/macos/mojave

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Question:

Question: Delete ._ Files from Network Drive

I've seen a number of discussions regarding this, but haven't found anything that has a straight forward, idiot proof method. I'm no Terminal wizard so all these lines of commands with no explanation mean nothing to me, I'm hoping someone can explain a relatively simple (or copy and paste) command I can use!


I have hard drive attached to my router working as a NAS drive, which is my main source for a media library (XBMC) running on a Raspberry Pi. I recently noticed that whenever I copied a file from my Macbook Pro onto that hard drive, XBMC would show two files that would appear exactly the same but one of them wouldn't play. When deleting these files I noticed that the "dead" files always started with a "._" before the normal file name.


My dad can see all these files and just delete them manually, but we have a massive media library and it's a total pain to sift through and do that as it'll take forever!


Is there a way, without using third party software that costs any money, to make these files visible within Finder so I can delete them from the network drive? They aren't a problem on my Macbook Pro so that's fine, I just want them off the network drive!


Any suggestions would be great, thanks 🙂

MacBook Pro, OS X Mavericks (10.9.5)

Posted on

Reply
Question marked as Helpful

Apr 16, 2015 11:08 AM in response to guitarwizard93 In response to guitarwizard93

These are 'dot underbar' files or 'Apple double' files.


OS X has a tool built in to clean these - it is a Terminal command

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ man1/dot_clean.1.html


The files are created when OS X stores files on a filesystem that does not support extended attributes - things like Spotlight comments or the 'downloaded from' URLs that are added to files from the internet. The get info dialog shows some extended attributes, but not all of them.

Deleting the files does lose this metadata.


You have a few options to clean them out…

A GUI app like Blueharvest (I haven't used this on network volumes).

http://www.zeroonetwenty.com/blueharvest/


A Terminal command on OS X, (attempt to merge & delete the files)

dot_clean -m /Volumes/Mounted-SMB-share


Or just delete them via 'find'

find /Volumes/Mounted-SMB-share -name ._\* -delete


Either of those can be wrapped up in a shell script, Applescript or Automator action to make it easy to run in the future.


A final option is to create a cron job on your server - frankly this is the best option - it can clean these files on a daily basis meaning you can forget about running it every time you get annoyed by them. The Pi server may also have the correct level of access too, since files shares can have permissions issues with many levels of directories mounted on other machines.



It is possible to show hidden files on OS X, however it is not very practical if you have more than a few folders to search through. I would seriously discourage this method, it's too easy to delete the wrong files when you are editing hundreds of files over a network in multiple folders. Viewing the invisible files & folders on the boot volume also encourages too much digging around too 🙂


NOTE: You may also want to remove .DS_Store files too. These store finder window info (sizes icon sorting options etc). The creation of these on network volumes can be disabled (if you use Terminal or an app like Secrets to set 'defaults write' values).

Secrets: "com.apple.desktopservices"


Ask if you want these explaining more - please verify the path to your shared disk inside /Volumes if you want help examining or altering those commands.

ls /Volumes

Will list all mounted disks in Terminal.

The paths on the raspberry pi will differ.

There’s more to the conversation

Read all replies

Page content loaded

Apr 16, 2015 10:43 AM in response to Eric Root In response to Eric Root

I'm not sure what you're suggesting, the drive does show up and I can browse the files either over the network or by attaching directly via USB. I just can't see the "._" files that I want to delete because Mac OS X hides them.

Apr 16, 2015 10:43 AM

Reply Helpful
Question marked as Helpful

Apr 16, 2015 11:08 AM in response to guitarwizard93 In response to guitarwizard93

These are 'dot underbar' files or 'Apple double' files.


OS X has a tool built in to clean these - it is a Terminal command

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ man1/dot_clean.1.html


The files are created when OS X stores files on a filesystem that does not support extended attributes - things like Spotlight comments or the 'downloaded from' URLs that are added to files from the internet. The get info dialog shows some extended attributes, but not all of them.

Deleting the files does lose this metadata.


You have a few options to clean them out…

A GUI app like Blueharvest (I haven't used this on network volumes).

http://www.zeroonetwenty.com/blueharvest/


A Terminal command on OS X, (attempt to merge & delete the files)

dot_clean -m /Volumes/Mounted-SMB-share


Or just delete them via 'find'

find /Volumes/Mounted-SMB-share -name ._\* -delete


Either of those can be wrapped up in a shell script, Applescript or Automator action to make it easy to run in the future.


A final option is to create a cron job on your server - frankly this is the best option - it can clean these files on a daily basis meaning you can forget about running it every time you get annoyed by them. The Pi server may also have the correct level of access too, since files shares can have permissions issues with many levels of directories mounted on other machines.



It is possible to show hidden files on OS X, however it is not very practical if you have more than a few folders to search through. I would seriously discourage this method, it's too easy to delete the wrong files when you are editing hundreds of files over a network in multiple folders. Viewing the invisible files & folders on the boot volume also encourages too much digging around too 🙂


NOTE: You may also want to remove .DS_Store files too. These store finder window info (sizes icon sorting options etc). The creation of these on network volumes can be disabled (if you use Terminal or an app like Secrets to set 'defaults write' values).

Secrets: "com.apple.desktopservices"


Ask if you want these explaining more - please verify the path to your shared disk inside /Volumes if you want help examining or altering those commands.

ls /Volumes

Will list all mounted disks in Terminal.

The paths on the raspberry pi will differ.

Apr 16, 2015 11:08 AM

Reply Helpful (5)
User profile for user: guitarwizard93

Question: Delete ._ Files from Network Drive