cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Control selective sync programmatically

Control selective sync programmatically

Igal Tabachnik
New member | Level 1

Hello,

I'm looking for a way to control selective sync programmatically? There's a certain folder I want to sync, for example, in certain hours of the day. With a cron job, I could instruct selective sync to include/exclude a folder.

Is this possible? Can you make it possible? 🙂

Thanks!

36 Replies 36

dwcapture
Helpful | Level 6

Yeah, this and several other requests are vital feature developments, but complex to integrate, requiring considerable effort.

 

Hmm, let's give it a little more time. To be reasonable, I'd say check back in about 15 years.

 

I'm sure by then they will be taken seriously and implemented.  🙂

Kieran360
Helpful | Level 5

Dropbox absolutely needs a better feature request system than "Post on a forum somewhere and we'll pass it on, we pinky swear".

 

hodasza
New member | Level 2

hodasza
New member | Level 2
  1. Open the PowerShell application on your computer.
  2. Type the code below, replacing the file/folder path placeholder with the file/folder path you’d like to ignore.
Set-Content -Path 'C:\Users\yourname\Dropbox(Personal)\YourFileName.pdf' -Stream com.dropbox.ignored -Value 1
to unignore:
Clear-Content -Path 'C:\Users\yourname\Dropbox(Personal)\YourFileName.pdf' -Stream com.dropbox.ignored
 

Kieran360
Helpful | Level 5

@hodaszayeah, that's not what we want, we want control of the selective sync feature. Ignored files are never synced to dropbox.

hodasza
New member | Level 2

You are right, I'm sorry!
I found this forum because of b9chris's post about VS dev problems and didn't read the original question.
Ignoring bin, obj, etc... folders is a solution for b9chris's problem - it helped me for sure.

b9chris
Helpful | Level 6

That worked!

I can't stand Powershell so here's some quick C# code that generates Powershell Dropbox ignore commands for every bin or obj folder in a root folder (since Visual Studio has a habit of throwing a ton of these all over a Solution/Project, and retyping all those paths is annoying).

 

public void MakePaths()

{

string rootPath = @"C:\Users\Chris\Dropbox\Code\2017\BrassNine";


var sb = new StringBuilder();

foreach(var path in problemFolders(rootPath))

{

sb.AppendLine($"Set-Content -Path '{path}' -Stream com.dropbox.ignored -Value 1");

}


string script = sb.ToString();

}

 

protected IEnumerable<string> problemFolders(string rootPath)
{

var dir = new DirectoryInfo(rootPath);

foreach (var badDir in dir.EnumerateDirectories("bin", SearchOption.AllDirectories))

yield return badDir.FullName;

foreach (var badDir in dir.EnumerateDirectories("obj", SearchOption.AllDirectories))

yield return badDir.FullName;

}

 

The script variable will be the Powershell lines to copy/paste into a Powershell window or .ps1 script.

 

I'm dumping mine into a root-level file named DropboxIgnores.ps1 so I can run it each time I restore to a new machine, since I don't think these ignores sync.

Need more support?