1

Having a Macbook with limited space, I purchased a portable SSD drive to keep my bigger files on, and my Dropbox folder. This works for the most part, however I noticed that when I migrated to the file system on this portable ssd, that I now had THOUSANDS of ._ files, essentially a 1to1 ._ to real file/folder. So if I had picture.jpg before, I now additionally had ._picture.jpg 0 byte file as well.

Doing some research I found that this had to do with the Mac working with a non-mac journaled file system and creating these files for a reason that I forget now.

So I started deleting these files folder by folder, but this was going to take forever. I have tons of website templates, backups, websites... literally thousands of tiny little files, now with these pesky ._ shadows.

So I had to find a way to remove all these files. My solution is listed as an answer below, which I provided on the dropbox community page. But I wanted to put this item here to see if anyone had a better way of accomplishing this task.

2
  • Yes, use the Terminal: cnet.com/uk/news/terminal-fun-deleting-repetitive-files-in-os-x
    – Richard
    Commented Dec 23, 2016 at 16:17
  • I just use find . -name "._*" -print, if all looks good, change it to find . -name "._*" -delete. Note that for Dropbox's case, you should stop the client and delete the .dropbox.cache folder first.
    – Iskar
    Commented Dec 23, 2016 at 16:21

2 Answers 2

1

The way I resolved this was to first, making a complete copy of my Dropbox onto another drive. This can be a time consuming process, at least for me, because I keep so many consulting client's websites, backups, etc which lead to thousands of small files. With the addition of all the ._ files, it doubled. My file count was in the 300,000+ range. However, after you make the backup, we can proceed.

Keep in mind, this plan assumes you ONLY use the removable drive on a Mac. If you need to share between file systems, I doubt this will work. I simply use Dropbox application itself to manage this on other devices instead of needing an all-inclusive file system.

  1. Close the Dropbox application if it is running.
  2. Backup your dropbox onto another drive (potentially time-consuming), and will include the dreaded ._ files.
  3. For integrity's sake, confirm your backup, maybe using a folder compare utility/app.
  4. Format your removable drive to athe mac journaled file system. I'm using a Samsung Portable SSD T3 1TB, formatted to a secure partition of Mac OS Extened (Journaled, Encrypted).
  5. Once your new volume is ready, open it in Finder.
  6. Copy your backup to a Dropbox folder
  7. Open the Terminal up.
  8. Change directory to your new volume's Dropbox folder, mine is PSSSD/Dropbox so the command was:

    cd /Volumes/PSSSD/Dropbox

  9. Being nervous about what I was about to do with a mass delete, I wanted to get a "WhatIf" (powershell reference), so we are going to just do a find without remove. My list was huge so I dumped it to a file. The first command below is output to the terminal, second to a file.

    find . -name '._*' find . -name '._*' > ~/Desktop/DropBox_filestodelete.txt

  10. Review the list. I had a lot of stuff in a ".dropboxcache" folder that I was unsure if I should delete or not, but gambling that cache will just be regenerated if needed, I decided to go ahead and let it delete.
  11. Here is a command that will find everything with ._ as the beginning of a file. Note that if you have real files of importance that have this same pattern, they will be deleted and you'll need to copy them from your backup to get them back. the "rm -fv" is what removes the file as it is found. The f of -fv is to delete without prompting (dangerous), and the v of the -fv is for verbose because I want to log all the files that I deleted for reference.

    find . -name '._*' -exec rm -fv {} \; >> ~/Desktop/filesdeletedoutput.txt

  12. This delete command may take some time. I actually stopped mine twice with CTRL-C but after reviewing the log file, found it was still working and I was just inpatient.
  13. The log files should be on your desktop if you hadn't already realized.
    Now start the dropbox application back up.
  14. If you used the same name for the formatted Volume and Folder as your previous Dropbox folder, Dropbox will probably start "Syncing" and "Indexing".

This will take some time. I had an issue moving my dropbox folder once where it wouldn't let me select a folder with a Dropbox folder already in it, but somehow I was able to get around that by cancelling one of the warnings/prompts and going into the Settings/Preferences of Dropbox.

You should eventually have Dropbox back up to par, without all the pesky ._ files. I again caution you when using the rm -fv or rm-rf as it will delete without warning and I believe bypass the trash or recycling bin.

0

The macOS operating system includes the dot_clean command, which services the problems described in your question. The man page from macOS 10.13.3 (High Sierra) is given below.

DOT_CLEAN(1)              BSD General Commands Manual             DOT_CLEAN(1)

NAME
     dot_clean -- Merge ._* files with corresponding native files.

SYNOPSIS
     dot_clean [-fmnsv] [--keep=[mostrecent|dotbar|native]] [dir ...]

DESCRIPTION
     For each dir, dot_clean recursively merges all ._* files with their cor-
     responding native files according to the rules specified with the given
     arguments.  By default, if there is an attribute on the native file that
     is also present in the ._ file, the most recent attribute will be used.

     If no operands are given, a usage message is output.  If more than one
     directory is given, directories are merged in the order in which they are
     specified.

OPTIONS
     -f      Flat merge.  Do not recursively merge all directories in the
             given dir.  This is off by default.

     -h      Help. Prints verbose usage message.

     -m      Always delete dot underbar files.

     -n      Delete dot underbar file if there is no matching native file.

     -s      Follow symbolic links.  This will follow symbolic dot underbar
             files when they are found.

     -v      Print verbose output.

     --keep=mostrecent
             The default option.  If an attribute is associated with a data
             fork, use that.  Otherwise, use information stored in the Apple-
             Double file.  Note that the native fork's data is preferred even
             if the data in the AppleDouble file is newer.

     --keep=dotbar
             Always use information stored in the AppleDouble file, replacing
             any extended attributes associated with the native file.

     --keep=native
             Always use the information associated with the data fork, ignor-
             ing any AppleDouble files.

EXAMPLES
     The following is how to do an dot_clean merge on the mounted volume test,
     always using the dot underbar information.

           dot_clean --keep=dotbar /Volumes/test

DIAGNOSTICS
     The dot_clean utility exits 0 on success, and >0 if an error occurs.

BUGS
     None known.

BSD                              Sept 27, 2012                             BSD

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .