dbxcli icon indicating copy to clipboard operation
dbxcli copied to clipboard

`put` target argument not working properly

Open grantseltzer opened this issue 9 years ago • 4 comments

I would assume based on the following help text that put can take a source (local file) argument, and/or an argument that represents a location on the users dropbox account for the file to go.

[*] dbxcli put --help
Upload files

Usage:
  dbxcli put [flags] <source> [<target>]

Global Flags:
      --as-member string   Member ID to perform action as
  -v, --verbose            Enable verbose logging

Instead, if a second argument is specified, the source is uploaded to the root of the dropbox account and is renamed to the second argument.

@diwakergupta is this how it was intended to be used and I'm just misinterpreting the help text?

I don't think the way it works now is very necessary. I'd like to add multiple arguments (including running them concurrently) and add a flag for destination which can specify a particular path to put all the arguments in.

grantseltzer avatar Sep 08 '16 23:09 grantseltzer

Hmm, git blame says that I wrote that usage text. Apparently I was basing it off out how put intuitively should work, instead of how it actually works.

It doesn't necessarily upload it to the root, it just makes the full path to the file whatever the target argument is. I guess it works correctly, in a sense, as long as you include the intended filename on the end of the target path. Otherwise it... overwrites the target folder with a file of the same name? Odd.

I can take a look at what's going on here unless you're planning on redoing put anyways.

waits avatar Sep 09 '16 00:09 waits

I don't think the issue is the help text, I think the behaviour should match what you wrote. Another issue is that it overwrites existing files/directories which I think should cause an error instead (Possibly have a force flag to overwrite).

I'm working on this now, but I'm interested to see what @diwakergupta has to say before submitting a PR.

grantseltzer avatar Sep 09 '16 00:09 grantseltzer

@diwakergupta Is there any documentation about how many upload requests the dropbox api can take? I have this working great except if there's a lot of files being passed as arguments at the same time in which case I get errors because of too many upload attempts.

grantseltzer avatar Sep 12 '16 19:09 grantseltzer

I made a PR with my changes in #54, that would be a good place to continue this discussion.

grantseltzer avatar Sep 26 '16 03:09 grantseltzer