dropbox / dbxcli

A command line client for Dropbox built using the Go SDK
Other
1.06k stars 99 forks source link

`put` target argument not working properly #52

Open grantseltzer opened 8 years ago

grantseltzer commented 8 years ago

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.

waits commented 8 years ago

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.

grantseltzer commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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