2

Here is grive's man page section for ignore.

--ignore <perl_regexp>
              Ignore  files  with  relative  paths  matching this Perl Regular
              Expression.  Value is remembered for next runs.

I do not know how to use perl regular expressions, but would like to be able to ignore multiple directories like so grive --ignore ./irrelevant/file.txt && ./unnecesary/file.txt

2 Answers2

4

Ignoring multiple directories can be done by using positive lookahead. This regex ignores the directories "irrelevant" and "unnecessary":

grive --ignore '(?=^irrelevant$)|(?=^unnecessary$)'

The dry-run command I used for testing:

grive --dry-run --verbose --ignore '(?=^irrelevant$)|(?=^unnecessary$)' > output.txt 2>&1

The directories 'irrelevant' and 'unnecessary' were ignored while the file 'irrelevant1' was not. Hope this works for you.

Update (as of 2017-04-01): latest version of grive2 introduced .griveignore which is syntactically close to .gitignore.

Florian-g
  • 56
  • 5
2

You can find something similar to what you're looking for on Grive Fork (Google Drive Linux Client) With Partial Sync Support [PPA]. Only, in that case, you tell grive2 what to sync instead of what not to sync. Here's the paragraph you need to look at:

Grive2 comes with some advanced features as well. For instance, compared to the original Grive, the new Grive2 fork supports partial sync. To only synchronize one subfolder (a folder from your ~/grive directory) with Google Drive, use:

grive -s SUBFOLDER

(replacing "SUBFOLDER" with the name of the subfolder you want to sync)

David Foerster
  • 36,890
  • 56
  • 97
  • 151
Edmonde
  • 41