bernd-wechner / Degoo

CLI tool(s) for working with Degoo cloud storage
Other
143 stars 41 forks source link

Move and rename commands #11

Closed MDKPredator closed 3 years ago

MDKPredator commented 3 years ago

I have created a new branch in which I have created the commands rename and mv. I hope this will help to complete all the available commands.

bernd-wechner commented 3 years ago

Thank you! Can you PR that too? Will get around to pulling them soon. Love your contribs.

I'm still hoping that Degoo can help us with a server side hash, or we can find a way to get eon from the Google store they use. it's what we need for a robust change detection. Currently I rely on file mod time and last upload time, which I'm not superbly comfortable with in this era. Better than nothing, but we provide a file hash on upload, and so one ought rightly be available to assess the need for download on.

bernd-wechner commented 3 years ago

Oh, I would consider collapsing rename and mv into one command. Simply more consistent with the Posix mv norm.

mv would call the appropriate API method SetRenameFile or SetMoveFile based on whether new name and old name have the same path (are in the same directory). Just a thought. One fewer commands to maintain and complies with the mv format common on Posix systems.

MDKPredator commented 3 years ago

When uploading large files, I was investigating if it was possible to upload chunks directly to the url, but the (few) attempts I made did not work. In any case don't expect help from Degoo support.

Yeah sure, no problem, I'll wrap the rename command inside mv. I already have this logic applied in a project where I mount a directory with the Degoo content (just like what rclone does).

I was waiting for the merge of the first changes before launching the second PR, but I think there will be no conflicts. When I have these last changes I will launch it.

MDKPredator commented 3 years ago

I have merged the rename and mv command. These are the use cases:

Rename in same folder - absolute path. Expected result: OK Web/test/Lorem.txt Web/test/Lorem

Rename in same folder. Expected result: OK Web/test/Lorem.txt Lorem

Move file to same directory. . Expected result: KO Web/test/Lorem.txt Web/test/

Move directory to a file. Expected result: KO Web/test/ Web/test/Lorem

Move folder to same folder. Expected result: KO Web/test/ Web/test/

Move directory to another one. Expected result: OK Web/test/temporal Web/test/secondDir

Move file to another directory. Expected result: OK Web/test/Lorem.txt Web/otherDir

Movie and rename file to another directory. Expected result: OK Web/test/Lorem.txt Web/otherDir/Lorem

bernd-wechner commented 3 years ago

Merged ... love your contributions! I'll heckle Degoo once more for some insight into server side hashes, but we can also consider looking in the Google services to see if they can provide one. That's the one diff feature I'm missing and I want to crontab this nightly some time to backup a NAS to Degoo.

bernd-wechner commented 3 years ago

Just a heads up that I seriously reworked this in: https://github.com/bernd-wechner/Degoo/commit/040d78fe2ec14cf65d30c69c305abf00eb46511f

I haven't had a chance to test every edge case yet, if you find time to hit it hard please do. Specifically I addressed the problem iv a move and rename and how that works if preexisting file shave those names.