Is there a way to tell Dropbox not to upload a certain file? (Eclipse related)

后端 未结 5 931
遇见更好的自我
遇见更好的自我 2021-01-31 09:33

I am trying to sync a code project between two computers, one running Windows and the other running Ubuntu 12.04. I use Eclipse on both machines, but the .metadata fold

相关标签:
5条回答
  • 2021-01-31 09:50

    If you're checking this in or after 2020, you can follow the official way to ignore a file/folder from syncing to dropbox from your computer.

    Although, at the time of writing this post, the feature is still in Beta.

    https://help.dropbox.com/files-folders/restore-delete/ignored-files

    ignoring is different from excluding.

    • Dropbox exclude removes the folder from your machine altogether. The file/folder does, however, stay on Dropbox's servers. Excluded folders can be included back onto your machine whenever you choose by going to the dropbox app's settings.
    • ignore lets you keep the file or folder on your machine but doesn't sync the file or folder to Dropbox at all. That means the folder only lies on your current machine and not on Dropbox.

    For example:

    1. You would choose dropbox exclude to exclude a big backup file that you don't have space for or don't need on your machine. The file/folder will still exist on Dropbox.

    2. You would choose to ignore folders from syncing to dropbox when your folder contains thousands or millions of temporary files that aren't necessary to be backed up. Backing up such a folder could cause Dropbox to use a lot of CPU cycles and RAM on your computer to keep track of all the changes to your files. This might slow down your computer.

      • An example of such a folder is node_modules which get installed in a node project directory. node_modules have quite a number of files within them which can be safely ignored from syncing to Dropbox and recreated by doing a npm install at any point in time.

      • You might also choose to ignore environment variable files containing secret keys to your web server or your ssh private keys. This could be useful while sharing folders across teams on Dropbox.

    How to Exclude: - To exclude a file from syncing from dropbox to your computer, you would need to either:

    • All platforms: Change the folders to sync in the selective sync settings in the Dropbox app.
    • Linux Dropbox CLI: Or run the command dropbox exclude add "FULL_PATH_TO_FILE_OR_FOLDER_TO_EXCLUDE" in your terminal.

    How to Ignore

    To ignore a file from getting synced from your computer to Dropbox, you'd need to run the following commands in the terminal while changing the FULL_OR_RELATIVE_PATH_TO_FILE_IN_DROPBOX in the commands below to the file/folder you need to exclude:

    Mac:

    1. alias dropboxignore="xattr -w com.dropbox.ignored 1"
    2. dropboxignore "FULL_OR_RELATIVE_PATH_TO_FILE_IN_DROPBOX"

    Linux:

    1. alias dropboxignore="attr -s com.dropbox.ignored -V 1"
    2. dropboxignore "FULL_OR_RELATIVE_PATH_TO_FILE_IN_DROPBOX"

    Windows - Powershell:

    Set-Content -Path "FULL_OR_RELATIVE_PATH_TO_FILE_IN_DROPBOX"
        -Stream com.dropbox.ignored -Value 1
    
    0 讨论(0)
  • 2021-01-31 10:04

    Right click on the taskbar icon, select preferences, then the advanced tab and set up selective sync. Enabling advanced view will help, too.
    In general, you should consider using a version control system like Subversion, Mercurial or git. You can make use of free hosting services (Assembla, Github, Bitbucket just to name a few) or set up a repository on a USB drive (works very well for personal projects).

    0 讨论(0)
  • 2021-01-31 10:05

    Using the Official Dropbox Command Line Interface (CLI)

    PROMPT$ dropbox help exclude
    dropbox exclude [list]
    dropbox exclude add [DIRECTORY] [DIRECTORY] ...
    dropbox exclude remove [DIRECTORY] [DIRECTORY] ...
    
    "list" prints a list of directories currently excluded from syncing.
    "add" adds one or more directories to the exclusion list, then resynchronizes Dropbox.
    "remove" removes one or more directories from the exclusion list, then resynchronizes Dropbox.
    With no arguments, executes "list".
    Any specified path must be within Dropbox.
    

    http://www.dropboxwiki.com/tips-and-tricks/using-the-official-dropbox-command-line-interface-cli

    0 讨论(0)
  • 2021-01-31 10:05

    Here is a script that will sync dropbox ignore with .gitignore in current folder and subfolders on Windows using Powershell. It requires the git command line to be installed.

    Get-ChildItem -Recurse | `
    Where-Object { $_.Name -eq '.gitignore' } | `
    ForEach-Object { `
        Write-Host $_.DirectoryName; `
        Push-Location $_.DirectoryName; `
        git status --ignored --short | `
          Where-Object { $_.StartsWith('!! ') } | `
          ForEach-Object { `
              $ignore = $_.Split(' ')[1].Trim('/'); `
              Write-Host $ignore; `
              Set-Content -Path $ignore -Stream com.dropbox.ignored -Value 1 `
          }; `
        Pop-Location `
     }
    
    0 讨论(0)
  • 2021-01-31 10:08

    You can name the file in such a way that Dropbox considers it a temporary file, which will prevent it syncing.

    eg. .~myfile.foo

    According to their help: https://www.dropbox.com/en/help/145 -

    Temporary files

    When some applications (such as Microsoft Word, Excel, or PowerPoint) open a file, they will often save a temporary file in the same directory and name it in one of the following ways:

    Name begins with ~$ (a tilde and dollar sign) or .~ (a period and tilde)

    • Name begins with a tilde and ends in .tmp, such as ~myfile.tmp
    • Dropbox does not sync these temporary files on any operating system.
    0 讨论(0)
提交回复
热议问题