NIH | National Cancer Institute | NCI Wiki  

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Replaced "/cygdrive/c/Users/JaneDoe" with "/NCI/JaneDoe" after discussion with Udit.
Excerpt
hiddentrue

dm_rename

Note

This page is a work in progress.

If your user account If your user account has the group administrator or system administrator role, and has the Write or Own permission level on an existing collection in DME (on all collections in the path), you can move one or more data files or collections to that existing collection in the following ways:

...

To move or rename one or more collections or files:

  1. In your file local system, create a JSON file that specifies a list of source and destination locations, as follows:

    Code Block
    {
     "moveRequests": [
      {
       "sourcePath": "<full path in DME to the file/collection to be moved>",
       "destinationPath": "<full path in DME to the new file/collection>"
      },
      {
       "sourcePath": "<full path in DME to the file/collection to be moved>",
       "destinationPath": "<full path in DME to the new file/collection>"
      }
     ]
    }
  2. Make sure that the destination collection or file does not already exist. each sourcePath and destinationPath pair in the JSON file meets the following criteria:
    • In the value of your destinationPath, the last part (collection name or data file name) is new.

    • In the value of your destinationPath, the parent collection already exists.

  3. Run the following command:

    code
    Panel
    borderColorsilver
    borderStylesolid
    Clipboard
    AllowLineWraptrue

    dm_rename

    [optional parameters] <move-description.json>

    [rename-status-file] [REST-response]


    The following table describes each parameter: 

    shared info - REST-response parameter
    ParameterDescription
    <move-description.json>A path to the JSON file containing the source and destination locations.
    [-h]If you want to print a usage (help) message for this command, specify this option.
    [-D <REST-response>]

    An optional parameter, specifying a path and filename in your local system. The system always creates a response file:

    • If you specify this parameter, the system saves the response from the server to the specified file in the specified location.
    • If you omit this parameter, the system saves the file as rename-response-header.tmp in your home directory.
    [-o <rename-status-file>]

    An optional parameter, specifying a

    [rename-status-file]An optional

    path and filename in your

    file

    local system. The system always creates a status file:

    • If you specify this parameter, the system
    creates
    • saves the status to the specified file in the specified location.
    • If you omit this parameter, the system prints the status to standard output and saves the status
    of the move or rename operation (the response from the server) in that file.
    [REST-response]
    Include Page
    shared info - REST-response parameter
    • as rename-response-message.json.tmp in your home directory.

    The status includes a result for each request (each source path and destination path pair). If the system was able to satisfy the request, the result is true. Otherwise, it's false. The status file provides an explanatory message in these cases.

    The status also includes an overall result. If all request statuses are true, then the overall result is true. Otherwise, it's false.

    <move-description.json>A path to the JSON file containing the source and destination locations.

For example, consider the following command:

code
Panel
borderColorsilver
borderStylesolid
Clipboard
AllowLineWraptrue

dm_rename

/

cygdrive

NCI/

c/Users/

JaneDoe/my-move-list.json


With the following code in the my-move-list.json file, the command moves and renames a collection from Project_Orig to Project_New and then renames a file from File_Orig to File_New:

Code Block
{
  "moveRequests": [
   {
     "sourcePath": "/Example_Archive/PI_Lab1Lab2/Project_Orig",
     "destinationPath": "/Example_Archive/PI_Lab2/Project_New"
   },
   {
     "sourcePath": "/Example_Archive/PI_Lab1Lab2/Project_Name12/File_Orig",
     "destinationPath": "/Example_Archive/PI_Lab2/Project_Name22/File_New"
   }
 ]
}

In this example, each sourcePath and destinationPath pair in the JSON file meets the above-mentioned criteria, as follows:

  • At command runtime, the Project_New collection name and File_New file name do not already exist.
  • At command runtime, the PI_Lab2 collection, Project_Orig collection, Project_2 collection, and File_Orig file already exist.  
  • In the first pair, only the Project_New collection name has changed. In the second pair, only the File_New file name has changed.