dandi / dandi-cli

DANDI command line client to facilitate common operations
https://dandi.readthedocs.io/
Apache License 2.0
22 stars 28 forks source link

[Feature] Download single NWB file given path #1434

Closed rly closed 7 months ago

rly commented 7 months ago

Sometimes I know only the dandiset ID and the file path, e.g., DANDI:000011 and path "sub-255201/sub-255201_ses-20141124_behavior+ecephys+ogen.nwb". I would like to use the CLI to download just that asset and store it on my filesystem either in the current directory or in the appropriate BIDS-like subdirectories 000011/sub-255201/sub-255201_ses-20141124_behavior+ecephys+ogen.nwb. How do I do that?

Currently I find that file on the web UI (or using python functions) to get the asset ID, but at that point, I might as well click the Download button.

I would like one of these or similar to work:

dandi download DANDI:000011/sub-255201/sub-255201_ses-20141124_behavior+ecephys+ogen.nwb
dandi download https://dandiarchive.org/dandiset/000011/0.220126.1907/files?location=sub-255201/sub-255201_ses-20141124_behavior+ecephys+ogen.nwb

Related to #1075

satra commented 7 months ago

@rly - this option (dandi download --help) should work like the single click download (and more).

- dandi://<instance name>/<dandiset id>[@<version>][/<path>]

i don't think there is a direct way of creating the path, but that should be doable post download since you know the path. and it would be nice to have a pointer to the handbook to explain the options to a new person (cc: @yarikoptic @kabilar)

dandi download dandi://DANDI/000011@0.220126.1907/sub-255201/sub-255201_ses-20141124_behavior+ecephys+ogen.nwb

you can replace the version with draft as well.

rly commented 7 months ago

Ah, that works. Thanks!