/
File Commands - pilotcli file

File Commands - pilotcli file

File commands for the pilotcli command line tool.

File Commands: pilotcli file

Help

$ pilotcli file --help Usage: pilotcli_windows file [OPTIONS] COMMAND [ARGS]... Options: --help Show this message and exit. Commands: attribute-export Export attribute template from a given Project. attribute-list List attribute templates of a given Project. download Download files/folders from a given Project/folder/file... list List files and folders inside a given Project/folder. metadata Download metadata file of a given file in target zone. move Move/Rename files/folders to a given Project path. resume Resume the upload process with a resumable upload log. trash Move files/folders to trash bin. upload Upload files/folders to a given Project path (eg.

Command: attribute-export

  • Options: -p --project-code, -n --attribute-name

  • Usage: Export an attribute from given Project by attribute name

  • Output:

    • (1) Attribute Template JSON file

    • (2) Attribute Definition JSON file

  • Prerequisites:

    • User login is required, otherwise error is returned: "The current login session is invalid. Please login to continue."

    • Project must be accessible to the user, otherwise, error is returned: "Project Code not found in list. Please verify and try again."

    • Requires the Project Code (retrieved via pilotcli project list).

    • Requires that the Attribute Template exists. If Attribute Template does not exist or is spelled incorrectly, the following error is returned: "Attribute 'sample-template' not found in Project. Please verify and try again."

    • pilotcli must have permission to write file in the directory

$ pilotcli file attribute-export --help Usage: pilotcli_linux file attribute-export [OPTIONS] Export attribute template from a given Project. Options: -p, --project-code TEXT Project Code -n, --attribute-name TEXT Attribute Template Name --help Show this message and exit.

Examples

(1) Export attributes from a given Project by attribute name:

  • Directly export an attribute by name from a given project

  • Denoting the project options are not required in the command explicitly, however if they are not included you will be prompted to enter them

  • Command structure: pilotcli file attribute-export

    • example: pilotcli file attribute-export

$ pilotcli file attribute-export ProjectCode: <Enter-Project-Code> AttributeName: <Enter-Attribute-Template-Name> Attribute-Template-Name -------------------------------------------------------------------------- | Attribute Name | Type | Value | Optional | -------------------------------------------------------------------------- | attr1 | multiple_choice | a1,a2,a3,a4,a5 | False | -------------------------------------------------------------------------- | attr2 | text | None | False | -------------------------------------------------------------------------- | attr3 | multiple_choice | t1,t2,t3,t4,t5 | True | -------------------------------------------------------------------------- Template saved successfully: Project-Code_Attribute-Template-Name_template.json Attribute definition saved successfully: Project-Code_Attribute-Template-Name_definition.json

(2) Export attributes from a given Project by attribute name with options:

  • Directly export an attribute by name from a given project, including the options in the command itself.

  • Command structure: pilotcli file attribute-export -p <project code> -n <attribute template name>

    • example: pilotcli file attribute-export -p IndocTestProject -n IMG_CoreMetadata


Command: attribute-list

  • Options: -p --project-code

  • Usage: List all attributes from given Project

  • Prerequisite:

    • User login is required, otherwise error is returned: ‘The current login session is invalid. Please login to continue.’

    • Requires the Project code (retrieved via pilotcli project list).

Examples

(1) List attributes from a given Project:

  • Generate a list of attributes in any given project.

  • Denoting the project options are not required in the command explicitly, however if they are not included you will be prompted to enter them

  • Command structure: pilotcli file attribute-list

    • example: pilotcli file attribute-list

(2) List attributes from a given Project with options:

  • Directly generate a list of attributes from a given project, including the options in the command itself.

  • Command structure: pilotcli file attribute-list -p <project code>

    • example: pilotcli file attribute-list -p IndocTestProject


Command: download

  • Usage: Download a file/folder from a Project using a full path: project code/folder type (users vs. shared)/folder name/file or folder name (i.e., indoctestproject/users/username/folder1/file.csv)

  • Options: -z --zone, -i --geid, --zip

    • To look up a file’s geid, or unique file ID, open the Project File Explorer in the Portal and inspect the File Properties for the ID.

  • Prerequisite:

    • User login is required, otherwise error is returned: "The current login session is invalid. Please login to continue."

    • File/folder must exist, otherwise error is returned: “File does not exist or source file provided is invalid: folder_name/file_name.”

    • If user has no access to the file/folder on the Portal, an error is returned: “Permission denied. Please verify that your role in the Project has permission to perform this action.”

Please be aware of the applicable zone restrictions depending on where you are using the pilotcli: Zone Restrictions with pilotcli

Examples

(1) Download file/folder from Green Room

  • Downloading a file/folder from Green Room with download command requires the environment variable to be configured, and pilotcli will prevent upload of duplicate file names (case insensitive). If user inputs multiple file/folder names, these files or folders will be downloaded one by one to the given directory.

  • Command structure: pilotcli file download <project code>/<folder type> (users or shared)/<folder name>/<file or folder name> <file output location>

    • example: pilotcli file download indoctestproject/shared/IMG/test.csv ~/Documents

(2) Download file/folder from Core

  • Use the download command to download a file/folder from Core with option -z or --zone.

  • Command structure: pilotcli file download <project code>/<folder type> (users or shared)/<folder name>/<file or folder name> -z <zone> (i.e., greenroom or core) <file output location>

    • example: pilotcli file download indoctestproject/shared/IMG/test.csv -z core ~/Documents

(3) Download multiple files/folders as a compressed zip

  • Use the download command to download multiple files/folders as a compressed zip file with option --zip.

  • Command structure: pilotcli file download <project code>/<folder type> (users or shared)/<folder name>/<file or folder name> -z <zone> (i.e., greenroom or core) <file output location> --zip

    • example: pilotcli file download indoctestproject/shared/IMG/test.csv -z core ~/Documents
      --zip

(4) Download file/folder by geid

  • Use the download command to download file(s)/folder(s) by geid with option -i --geid. The option -z --zone is not required when downloading by geid.

  • Command structure: pilotcli file download -i <geid from file 1> <geid from file 2> <file output location>

    • example pilotcli file download -i 6d89afd4-f86e-4df7-b6c5-01a9af4e828e-1627499957 7e8e2bac-97c6-4738-bc08-12139c9ba225-1627498854 ~/Documents

  • If the --zip option is used then command interface will automatically group input geid by the project, zone and then download as different zip files.

  • Command structure: pilotcli file download -i <geid from file 1> <geid from file 2> <file output location> --zip

    • example: pilotcli file download -i 6d89afd4-f86e-4df7-b6c5-01a9af4e828e-1627499957 7e8e2bac-97c6-4738-bc08-12139c9ba225-1627498854 ~/Documents --zip


Command: list

  • Options: -z --zone

  • Usage: List files and folders in the directory. Folders will be displayed in blue and files will be displayed in white.

  • Prerequisite:

    • User login is required, otherwise error is returned: "The current login session is invalid. Please login to continue."

    • Project must be accessible to the user, otherwise, error is returned: "Project Code not found in list. Please verify and try again."

    • Requires the Project code (retrieved via pilotcli project list) and path.

    • Requires indicating whether the folder is a shared folder or a user folder in the file path. Not denoting this will return only two options shared users

By default, only the first ten elements will be displayed. If you have access to more than ten files/folders in a certain Project, you will be prompted to use your arrow keys to select one of two options to either view the next ten items (next page), or to exit (exit) to return to the command line. The selected option is indicated by two arrows and can be confirmed by hitting enter:

Examples

(1) List files/folders in a Green Room user folder

  • List all files/folders in a Green Room folder

  • -z is not required, however you must denote whether the folder is a shared folder or a user folder in the path in order to return the file/folder list

  • Command structure: pilotcli file list <project code>/<folder type> (users or shared)/<folder name>

    • example: pilotcli file list indoctestproject/shared/IMG

(2) List files/folders in a Core shared folder

  • List all files/folders in a Core folder

  • Command structure: pilotcli file list <project code>/<folder type> (users or shared)/<folder name> -z <zone> (i.e., greenroom or core)

    • example: pilotcli file list indoctestproject/shared/IMG -z core

 

(3) List files/folders in Trash Bin from the Green Room

  • List all files/folders in the Trash Bin from the Green Room

  • Non-administrator users with access to the Trash Bin can only view the files they have moved to trash. Platform and Project Administrators can view the files in the Trash Bin from all Project members.

  • Command structure: pilotcli file list <project code>/trash -z greenroom

    • example: pilotcli file list indoctestproject/trash -z greenroom

(3) List files/folders in Trash Bin from the Core

  • List all files/folders in the Trash Bin from the core

  • Non-administrator users with access to the Trash Bin can only view the files they have moved to trash. Platform and Project Administrators can view the files in the Trash Bin from all Project members.

  • Command structure: pilotcli file list <project code>/trash -z core

    • example: pilotcli file list indoctestproject/trash -z core


Command: metadata

  • Usage: Download a file’s metadata including properties, attributes, and tags.

  • Options: -z --zone, -g --general, -a --attribute, -t --tag

  • Output:

    • (1) attribute.json - a file containing the file’s attributes

    • (2) general.json - a file containing the file’s general metadata

    • (3) tag.json

  • Prerequisites:

    • User login is required, otherwise error is returned: "The current login session is invalid. Please login to continue."

    • File must exist, otherwise error is returned: “File does not exist or source file provided is invalid: folder_name/file_name.”

    • If user has no access to the file/folder on the Portal, an error is returned: “Permission denied. Please verify that your role in the Project has permission to perform this action.”

(1) Download a file with general metadata, attributes, and tags.

  • Download file metadata in the form of: attribute.json, general.json, tags.json

  • Command structure: pilotcli file metadata -g . -a . -t . -z <zone> (i.e., greenroom or core) <project code>/<folder type> (users or shared)/<folder name>/<file or folder name>

    • example: pilotcli file metadata -g . -a . -t . -z core indoctestproject/shared/IMG/testfile.csv

 






 Related articles