Skip to content

Commit 0c634fd

Browse files
authored
Merge pull request #1098 from dandi/gh-1092
Add examples to `dandi move` docs
2 parents dc69353 + e87e49e commit 0c634fd

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

dandi/cli/cmd_move.py

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ def move(
8080
to the current directory, if in a subdirectory of a Dandiset); if a path
8181
matches, the matching portion is replaced with the replacement string,
8282
after expanding any backreferences.
83+
84+
For more information, including examples, see
85+
<https://dandi.rtfd.io/en/latest/cmdline/move.html>.
8386
"""
8487

8588
from .. import move as move_mod

docs/source/cmdline/move.rst

+31
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,34 @@ set to a nonempty value.
9090
.. option:: --devel-debug
9191

9292
Do not use pyout callbacks, do not swallow exceptions, do not parallelize.
93+
94+
95+
Examples
96+
--------
97+
98+
- When working in a local clone of a Dandiset, a file
99+
:file:`sub-01/sub-01_blah.nii.gz` can be renamed to
100+
:file:`sub-02/sub-02_useful.nii.gz` in both the local clone and on the server
101+
with::
102+
103+
dandi move sub-01/sub-01_blah.nii.gz sub-02/sub-02_useful.nii.gz
104+
105+
To rename the file only in the local or remote instance, insert ``--work-on
106+
local`` or ``--work-on remote`` after ``move``.
107+
108+
- When not working in a local clone of a Dandiset, a file can be renamed in a
109+
remote Dandiset on a server by providing a resource identifier for the
110+
Dandiset to the ``--dandiset`` option. For example, in order to operate on
111+
Dandiset 123456 on the main ``dandi`` instance, use::
112+
113+
dandi move --dandiset DANDI:123456 sub-01/sub-01_blah.nii.gz sub-02/sub-02_useful.nii.gz
114+
115+
To operate on Dandiset 123456 on ``dandi-staging``, you can use::
116+
117+
dandi move --dandiset https://gui-staging.dandiarchive.org/dandiset/123456 sub-01/sub-01_blah.nii.gz sub-02/sub-02_useful.nii.gz
118+
119+
- To move the contents of a folder :file:`rawdata/` to the top level of a
120+
Dandiset, you can use the ``--regex`` option to strip the ``rawdata/`` prefix
121+
from the beginning of all matching asset paths::
122+
123+
dandi move --regex "^rawdata/" ""

0 commit comments

Comments
 (0)