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.
Answer
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.
- Close the Dropbox application if it is running.
- Backup your dropbox onto another drive (potentially time-consuming), and will include the dreaded ._ files.
- For integrity's sake, confirm your backup, maybe using a folder compare utility/app.
- 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).
- Once your new volume is ready, open it in Finder.
- Copy your backup to a Dropbox folder
- Open the Terminal up.
Change directory to your new volume's Dropbox folder, mine is PSSSD/Dropbox so the command was:
cd /Volumes/PSSSD/Dropbox
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
- 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.
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
- 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.
- The log files should be on your desktop if you hadn't already realized.
Now start the dropbox application back up. - 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.
No comments:
Post a Comment