dropbox / dbxcli

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

Usage question with wildcards #72

Closed deanna closed 7 years ago

deanna commented 7 years ago

Hey y'all,

Discovered this genius lil project while looking for a way to organize my Dropbox files via command line-- I have a very large folder that's not synced with my desktop, and the web interface is so slow and gross for doing heavy lifting. I'm on mac OS 10.12.5, and downloaded the latest Darwin binary (v2.0.2).

I have enough general command line knowledge to break just about anything, which ultimately means I can get around, but not well. What I'd like to do in plain English is this: "Move all files that begin with '2012-' in the 'Photos backup-- 2011-2016' folder to a subfolder there called '2012.'" I like to live on the edge, so I tried a few ways, with no success. Here's what I thought I should do, with its output.

$ dbxcli mv "Photos backup-- 2011-2016/2012-*.*" "Photos backup-- 2011-2016/2012/"
Move error: &{{/Photos backup-- 2011-2016/2012-*.* /Photos backup-- 2011-2016/2012//Photos backup-- 2011-2016/2012-*.*} false false}

Any help for my bull-in-a-china-shop technique is greatly appreciated. [smash smash]

diwakergupta commented 7 years ago

Hey @deanna , sorry for the delay and thanks for trying out dbxcli! Can you run with -v and paste the output? Note that unlike their POSIX variants, some dbxcli commands like mv and cp treat both <src> and <dst> as paths within your Dropbox folder. I know the documentation is lacking -- I welcome (and really appreciate) PR!

deanna commented 7 years ago

No worries on timing! Appreciate any help in general.

$ dbxcli mv -v "Photos backup-- 2011-2016/2012-*.*" "Photos backup-- 2011-2016/2012/"
2017/07/08 10:01:16 client.go:1893: arg: &{{/Photos backup-- 2011-2016/2012-*.* /Photos backup-- 2011-2016/2012//Photos backup-- 2011-2016/2012-*.*} false false}
2017/07/08 10:01:16 client.go:1910: req: &{POST https://api.dropboxapi.com/2/files/move HTTP/1.1 1 1 map[Content-Type:[application/json]] {0xc420073ce0} 0x1257b10 178 [] false api.dropboxapi.com map[] map[] <nil> map[]   <nil> <nil> <nil> <nil>}
2017/07/08 10:01:17 client.go:1914: resp: &{409 Conflict 409 HTTP/1.1 1 1 map[Date:[Sat, 08 Jul 2017 14:01:14 GMT] Content-Type:[application/json] Connection:[keep-alive] X-Dropbox-Request-Id:[d5a388d50dd091e56c0a51a81f221d71] Server:[nginx]] 0xc42034d940 -1 [chunked] false false map[] 0xc4200d4600 0xc4202f89a0}
2017/07/08 10:01:17 client.go:1927: body: {"error_summary": "from_lookup/not_found/..", "error": {".tag": "from_lookup", "from_lookup": {".tag": "not_found"}}}
Move error: &{{/Photos backup-- 2011-2016/2012-*.* /Photos backup-- 2011-2016/2012//Photos backup-- 2011-2016/2012-*.*} false false}
diwakergupta commented 7 years ago

Hey @deanna , I'll try to improve the self-help documentation and error handling, but what you're trying is simply not supported, at least now. Key is what I mentioned earlier: dbxcli mv requires that both src and dst are already within your Dropbox.

Notably, your command relies on shall expansion, which means it'll only work for local files. You might be able to achieve the desired result by filtering the output of dbxcli ls and piping it into dbxcli mv with some shell-fu to glue everything together.

I'm going to close this out, but feel free to re-open (or file another issue) as needed!