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

  • I am running ubuntu 14.04, and very recently installed grive. – Jason Basanese Aug 23 '16 at 19:41
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.

| improve this answer | |
  • The .griveignore option haven't worked out but the --ignore options persists so it's even better. – MaikoID May 31 '17 at 20:12
  • 1
    in version 0.5.1-dev from the master grive2, the option --ignore is gone (I get the message Options are incorrect. Use -h for help), and the .griveignore capabilities are only offered in the grive2 fork by vitalif. What am I supposed to do? – user540997 Sep 28 '17 at 21:53
  • So apparently vitalif/grive2 is the intended branch to install for the most up-to-date version. Strange. – user540997 Sep 28 '17 at 22:25
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)

| improve this answer | |
  • This is something i had not considered, so thanks. However the bulk of the question is about how to create a perl regexp for multiple directories. – Jason Basanese Aug 26 '16 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.