19

After another user asked this question: Dropbox on linux server - how to include/exclude folders?

My icon is still not working after performing some of the steps listed in other questions and answers:

Edit: In case anyone was wondering while reading this post, I was able to get my icon to show up finally by following these links:

The question should still be valid for anyone that wants to do this from the command line.

There was an answer for excluding, but not one for including. Is there any way to achieve this?

I see the former command listed in the dropbox command's help text, but not anything that could help me with including.

Does anybody know how to achieve this?

Here is the current help text that I see:

Dropbox command-line interface  

commands:  

Note: use dropbox help <command> to view usage for a specific command.  

 status       get current status of the dropboxd  
 help         provide help  
 puburl       get public url of a file in your dropbox  
 stop         stop dropboxd  
 running      return whether dropbox is running  
 start        start dropboxd  
 filestatus   get current sync status of one or more files  
 ls           list directory contents with current sync status  
 autostart    automatically start dropbox at login  
 exclude      ignores/excludes a directory from syncing  
 lansync      enables or disables LAN sync  

I also found some official Dropbox help documentation that also strangely only mentions excluding files, without including others from the Dropbox folder that are not currently synced.

1

2 Answers 2

29

To exclude all files/folders:

  • cd to your dropbox folder (usually cd ~/Dropbox)
  • then type ~/bin/dropbox.py exclude add * This will exclude everything in your dropbox folder from syncing. (Be careful! This will remove all the files that you synced)
  • Then, if you want to start syncing the folder "dir", type ~/bin/dropbox.py exclude remove dir

Taken from http://www.dropboxwiki.com/tips-and-tricks/using-the-official-dropbox-command-line-interface-cli#comment-1778553228

4
  • 4
    This will of course remove all the files that you synced (since by default it's everything), then re-add the one directory and re-download it - be aware of that..
    – frumbert
    Nov 17, 2016 at 4:25
  • @frumbert edit my answer to better reflect this
    – devunder
    May 4, 2017 at 20:10
  • 2
    Use ~/Dropbox/* instead of just * when excluding. Jan 15, 2018 at 7:24
  • 2
    How can i prevent new created folder and file for sync with dropbox
    – S.P
    Jan 19, 2018 at 10:02
2

If you need to simply sync one deep directory you may need to repeat the previously accepted Answer procedure recursively. For example, if you are trying to sync a Minecraft server to a hosted VM, where the files you need are located in /Dropbox/Media/Software/Games/Minecraft you can do:

cd ~/Dropbox
~/bin/dropbox.py exclude add *
~/bin/dropbox.py exclude remove Media
<wait for partial sync>
cd Media
~/bin/dropbox.py exclude add *
~/bin/dropbox.py exclude remove Software
<wait for partial sync>
cd Software
~/bin/dropbox.py exclude add *
~/bin/dropbox.py exclude remove Games
<wait for partial sync>
cd Games
~/bin/dropbox.py exclude add *
~/bin/dropbox.py exclude remove Minecraft

Basically you have to go through several rounds of exclude/include, one for each subdirectory deeper you go.

You must log in to answer this question.

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