Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--dir argument not working when combined with --ignore #125

Closed
MangoMango666 opened this issue Dec 21, 2016 · 7 comments
Closed

--dir argument not working when combined with --ignore #125

MangoMango666 opened this issue Dec 21, 2016 · 7 comments

Comments

@MangoMango666
Copy link

MangoMango666 commented Dec 21, 2016

Hello.

I have been trying to make work the --dir (or -s ) parameter, but without success. The whole directory gets synchronized.

However I just found this does not always happen:

the following command seems to work fine : grive --dir TestSubDir

However the following synchronizes the whole Drive :
grive --dir TestSubDir --ignore 'desktop\.ini$|Thumbs\.db|\.gsheet$|\.gdoc$|\.gmap$|\.gform$|\.gslides$|\.gdraw$|\.gtable$|\.tmp\.drivedownload|\.odt#|\.ods#'

From what I can guess, I would bet that since the functioning of the --dir argument is to convert into a regexp, it is not compatible with using the --ignore argument, right ?

I use the --ignore argument to avoid synchronizing the temporary files, and system files (the computer is a dual-boot Windows-Linux).

@MangoMango666 MangoMango666 changed the title --dir (or -s) not working --dir argument not working when combined with --ignore Dec 21, 2016
@ANDRON94
Copy link

ANDRON94 commented Dec 26, 2016

I have the same issue too.
I parse a source files a little bit and in "State.cc" State constructor use "ignore" option(if it exists) and then fall back to "dir" option which override "m_ign" member variable.
I think, author should separate logic of "dir" and "ignore" options or leave only "ignore" option(which more general).

@vitalif
Copy link
Owner

vitalif commented Dec 26, 2016

I think I'll just rework it to .griveignore

@ANDRON94
Copy link

Thank you, it's a good app =)

@MangoMango666
Copy link
Author

Hi.
I also second Andron94's last comment : thanks for your work !

Now, if I may suggest something, let me add : .griveignore seems a great idea, as for those of us who want to avoid synchronizing system files or temporary files, the --ignore argument becomes otherwise quite lengthy. However, it would be better if the --dir argument is still possible and compatible with the --ignore / .griveignore argument.

Indeed, the --dir argument is circumstantial, i.e. the user chooses to add his argument because at the precise moment where he runs the command, he needs to synchronize a specific directory.
In the other hand, the use of --ignore argument, or even more the .griveignore file, is in my mind not circumstantial : it is a choice made for all synchronizations now and later.

Ok: I know it is easier to ask for features than coding them. So my best regards and as said before : we appreciate your work.

vitalif added a commit that referenced this issue Mar 19, 2017
vitalif added a commit that referenced this issue Mar 19, 2017
@MangoMango666
Copy link
Author

MangoMango666 commented Apr 5, 2017

Hello.

I saw that you committed a new version of Grive (0.5.1) that implements .griveignore . Thank !

I went on testing it. Unfortunately, I could not make it work. Maybe because I did not understand how to use it. From the indications in the readme file , I was not sure how to use it.

First question : from what I understand, the .griveignore file is only taken in account when the no-remote-new or the upload-only modes are used, right ?

Second question :
Is the use of .griveignore compatible with the --dir parameter ?
It seems it is not, from what I could see during my tests below.

Third question :
If you want to ignore all files with a certain extension in all folders (e.g. : .gdoc), should append to .griveignore a line like
*.gdoc
or a line like
**/*.gdoc
or both ?

Indeed, here is the test I did :
I created a folder 'Test Grive' at the root of my Grive folder and pasted in it a few files, including some that I want to be ignored and some that I don't want to be ignored by the synchronization.

The test files are the following :
desktop.ini
Test_Google_doc_file.gsheet
.~lock.Test_LO_Writer_file.odt#
Test_LO_Writer_file.odt
Test_simple_text_file.txt

The 3rd file is a temporary LibreOffice file (obtained while Test_LO_Writer_file.odt is opened with LO).
I want that the first 3 files in the list ( desktop.ini , the .gsheet and the LO temporary files) be ignored during synchronization.

So I created the following .griveignore file, located at the root of the Grive folder.:
# Ignore Windows system files
*Thumbs.db
*desktop.ini
**/Thumbs.db
**/desktop.ini
# Ignore LibreOffice's temporary files
*.odt#
*.ods#
*.odp#
*.odg#
**/*.odt#
**/*.ods#
**/*.odp#
**/*.odg#
# Ignore Google Docs files
*.gsheet
*.gdoc
*.gmap
*.gform
*.gslides
*.gdraw
*.gtable
**/*.gsheet
**/*.gdoc
**/*.gmap
**/*.gform
**/*.gslides
**/*.gdraw
**/*.gtable

I was not sure if I had to include *desktop.ini or **/desktop.ini as a pattern so I included both. It seems it is the **/*.gsheet pattern that achieves what I want.

Now, this is what I get when running Grive on this test folder using the --dir attribute, I have this :
grive --dry-run --upload-only --dir Test_Grive/
Reading local directories
Reading remote server file list
Synchronizing files (dry-run)
sync "./Test_Grive/.~lock.Test_LO_Writer_file.odt#" doesn't exist in server, uploading
sync "./Test_Grive/desktop.ini" doesn't exist in server, uploading
sync "./Test_Grive/Test_Google_doc_file.gsheet" doesn't exist in server, uploading
sync "./Test_Grive/Test_LO_Writer_file.odt" doesn't exist in server, uploading
sync "./Test_Grive/Test_simple_text_file.txt" doesn't exist in server, uploading
Finished!

i.e. : the .griveignore file is not taken in account.

While, if I don't use the --dir flag, it is taken in account.

@MangoMango666
Copy link
Author

Actually, after further tests, I conclude that :
the *.gsheet line in .griveignore is necessary to ignore the .gsheet files at the root of the Grive folder, while the **/*.gsheet line is necessary to ignore the .gsheet files in the subdirectories. Right ?

@MangoMango666
Copy link
Author

And, no I was wrong : the .griveignore file seems to work also when not using the normal bidirectional synchronization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants