odeke-em / drive

Google Drive client for the commandline
Apache License 2.0
6.68k stars 428 forks source link

Auto create target folder on google disk #976

Open Dravon5X opened 6 years ago

Dravon5X commented 6 years ago

Hi

here you have my opinion as new user of this tool. I want quick and easy way to synchronize files from Raspberry Pi to google disk. Problem is, that in script I need (I think) first check if remote folder exist and if not then create it.

My idea: add parameter (or make it as default) that "push -destination folder-name" will create that "folder-name" if is doesn't exist, and if exist then use it.

Currently if the folder don't exist, new folder is created but with name of my current folder on raspberry where I started 'drive' command. And every time I run push command, every time is created new folder with same name, now I know that google disk allow more folders with same name.

That is not desired behaviour I think, because multi folders with same name are created, but if then I will use target folder name of that existing folders, still only one folder will be used for push.

So adding what I'm asking will eliminate this multifolder issue and also scripts will be more simple without needing to check if folder exists.

what you think?

davidhcefx commented 6 years ago

Hi, @Dravon5X

I understand that you want a more intuitive way of synchronizing files. For example, a push command that would push all new updates to the cloud AUTOMATICALLY.

It turns out that, drive push already behaves that way! When you created a file, it would push ONLY that file to the cloud and leave the rest unmodified. Therefore, you don't have to check if remote folder exist or not before uploading a file inside of it. Because if the folder already exist and you made some changes inside of it, drive would ONLY upload those changes and would not create another folder for you.

And every time I run push command, every time is created new folder with same name...

So adding what I'm asking will eliminate this multifolder issue...

What you have confronted is NOT the original behavior of drive. In fact, I think that's the bug #951, which would happen when uploading directories with plenty of layers, which they are still fixing.

You can try the following out and verify that drive push would function as what you're looking for:

mkdir folder
touch folder/testA
drive push folder
touch folder/testB
drive push folder