Need to see if your shared folder is taking up space on your dropbox đŸ‘šâ€đŸ’»? Find out how to check here.

Forum Discussion

Igal Tabachnik's avatar
Igal Tabachnik
New member | Level 1
11 years ago

Control selective sync programmatically

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

Replies have been turned off for this discussion
  • Kieran360's avatar
    Kieran360
    Helpful | Level 5
    5 years ago

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

     

  • hodasza's avatar
    hodasza
    New member | Level 2
    5 years ago
    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's avatar
    Kieran360
    Helpful | Level 5
    5 years ago

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

  • hodasza's avatar
    hodasza
    New member | Level 2
    5 years ago

    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's avatar
    b9chris
    Helpful | Level 6
    5 years ago

    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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!