File and Folder Commands
The following Globus Command Line Interface (CLI) commands provide information about, and perform functions on, the files and folders at a Globus endpoint. Many of the command names are familiar from Linux, but these CLI commands are distinct and may have different options. Visit the linked reference pages for more details on each of these commands.
These commands are demonstrated using Globus "tutorial endpoints",
which are administered by the Globus team on their servers.
These endpoints always exist, contain known data files and are accessible to all Globus users.
The examples will refer to these endpoints using the shell variables
$gte1
and $gte2
.
Those variables can be initialized by searching for the endpoints
and then assigning their IDs to the variables, like this:
CLI commands that work with endpoints specify file and folder locations as combinations of the endpoint ID and an optional colon, followed by a path:
For the Globus Tutorial endpoints, if no path is specified
the user's home directory is selected.
Alternatively, the path could begin with "/" to access some public folders on the endpoint.
The following examples will use the public folder /share/godata
and its contents.
globus ls
The globus ls
command
lists the contents of a specified endpoint
and optional path.
The command's options include -a, --all
to include hidden files,
-l, --long
to produce long form output and
-r, --recursive
for recursively printing contents of folders.
Note that unlike the Linux ls
command,
the CLI ls
does not allow patterns or wildcards to be specified in the path.
Pattern matching must be done using the --filter
option.
The option takes a pattern string, which must begin with one of the following:
=
- (exact match)
~
- (regular expression match)
!
- (not exact match)
!~
- (not regular expression match)
These examples list the contents of the Globus Tutorial Endpoint #1's /share
folder,
as well as the contents of its godata
sub-folder.
globus mkdir
The globus mkdir
command
creates a new directory at the given endpoint/path combination:
The command returns 0 on success (as in the example below), 1 if there was an error (including if the path already exists), and 2 if the command was used improperly.
globus rename
The globus rename
command
renames a file or directory on an endpoint at the first path
to have the name given by the second path:
The new path must not already exist. The command returns 0 on success, 1 if there was an error, and 2 if the command was used improperly.
globus rm
The globus rm
command
removes a file or directory at the given endpoint/path combination:
When the path refers to a directory, you must use the "-r" recursive option. The remove operation is performed asynchronously and its progress can be tracked using the task ID that is returned by the command. The command has numerous options, some of which relate to managing the task. The command returns 0 on success, 1 if there was an error, and 2 if the command was used improperly.