Un-clutter Your Dropbox on Mac Using chflags and ln
Dropbox integrates with a lot of different apps. If you use a lot of these third-party apps, your Dropbox might start to get cluttered and look like this:
I wanted to have all my third-party apps to be in a single folder called Applications. I first tried just moving the folders, but when I used the app again, a new folder was created at the root of my Dropbox folder. So now there were two different folders. But thanks to some Unix commands, I can keep my Dropbox clutter-free and put third-party folders where I want them to live.
I’ll use Scanner Pro as the example here. First, create an Applications folder in your Dropbox.
Then, run this command (replacing the folder name for any other folder you want to live in Applications):
ln -s ~/Dropbox/ScannerPro ~/Dropbox/Applications/ScannerPro
Finally, hide the original folder from the Finder in your Dropbox folder with this command:
chflags hidden ~/Dropbox/ScannerPro
The ScannerPro folder still lives in the root of Dropbox, but a symlink was made in
~/Dropbox/Applications that points to it, so all of the same files are there. This is the folder that will be visible and the real folder will be hidden.
If you did it right, you should be able to run this command to view the hidden folders in your Dropbox:
ls -lO ~/Dropbox/
This will show a long-listing of the items in
~/Dropbox and show file flags (the hidden flag that was applied in the command above). See the highlighted lines below show hidden.
drwxr-xr-x 8 jacob_salmela staff - 272 Jun 19 12:41 Applications drwxr-xr-x@ 12 jacob_salmela staff - 408 Jun 13 20:05 Camera Uploads drwxr-xr-x 31 jacob_salmela staff - 1054 Jun 19 10:56 Documents drwxr-xr-x 9 jacob_salmela staff - 306 May 4 17:52 Games drwxr-xr-x@ 6 jacob_salmela staff hidden 204 Jun 13 20:52 Itemizer drwxr-xr-x 10 jacob_salmela staff - 340 Apr 25 08:43 Movies drwxr-xr-x 7 jacob_salmela staff - 238 May 4 17:56 Music drwxr-xr-x@ 3 jacob_salmela staff hidden 102 May 4 18:16 Notability drwxr-xr-x@ 15 jacob_salmela staff - 510 Jun 11 08:53 Pictures drwxr-xr-x@ 7 jacob_salmela staff - 238 Jun 10 13:59 Public drwxr-xr-x@ 11 jacob_salmela staff hidden 374 Jun 19 10:52 ScannerPro drwxr-xr-x 5 jacob_salmela staff - 170 Jun 10 13:56 Shared drwxr-xr-x@ 5 jacob_salmela staff hidden 170 Jun 5 12:11 TextExpander drwxr-xr-x@ 2 jacob_salmela staff hidden 68 Jun 19 10:56 VRecorder!
If you run the ls command on the Applications folder,
ls -l ~/Dropbox/Applications
you will see the symlink you created–indicated by an arrow pointing to the original folder. The first letter will also be an
l, indicating it is a link.
lrwxr-xr-x 1 jacob_salmela staff 39 Jun 19 12:41 ScannerPro -> /Users/jacob_salmela/Dropbox/ScannerPro
Hiding these folders is great while using Dropbox on your Mac, but when you view your files from Dropbox.com, they will no longer be hidden, as this trick applies only locally to the Mac.
Using this Trick for Files
You can apply the
ln command to files as well. Just leave off the
ln ~/Dropbox/myHiddenFile.txt ~/Dropbox/Documents/myVisibleFile.txt
The cool thing is that even if you delete the myHiddenFile.txt, it will still be accessible via the other path. This is because the file is not gone until all its hard links are removed.