CLI¶
The CLI can be accessed through the command stor
. For details on
valid subcommands, usage, and input options, refer to the --help
/ -h
flag.
In addition to UNIX-like basic list, copy, and remove commands, the CLI also
has some features such as specifying a current working directory on an OBS service
(which allows for relative paths), cat
, and copying from stdin
.
The list
command is different from the ls
command. list
recursively
lists all files and directories under a given path while ls
lists the path
as a directory in a way that is similar to the UNIX command.
To copy or remove a tree, use the -r
flag with cp
or remove
.
Relative Paths¶
Using the CLI, the user can specify a current working directory on supported
OBS services (currently swift and s3) using the cd
subcommand:
$ stor cd s3://bucket
$ stor cd swift://tenant/container
$ stor cd dx://myproject:/dir
To check the current working directory, use the pwd
subcommand:
$ stor pwd
s3://bucket
swift://tenant/container
dx://myproject:/dir
To clear the current working directory, use the clear
subcommand:
$ stor clear
$ stor pwd
s3://
swift://
dx://
This also means that relative paths can be used. Relative paths are indicated
by omitting the //
in the path and instead indicating a relative path, as
shown:
$ stor cd s3://bucket/dir
$ stor list s3:child
s3://bucket/dir/child/file1
s3://bucket/dir/child/file2
$ stor list s3:./child
s3://bucket/dir/child/file1
s3://bucket/dir/child/file2
$ stor list s3:..
s3://bucket/a
s3://bucket/b/obj1
s3://bucket/dir/child/file1
s3://bucket/dir/child/file2
stdin
and stdout
¶
The CLI offers the ability to copy from stdin
and output a path’s
contents to stdout
.
To copy from stdin
, use the special -
symbol. This means that the
user can pipe output from one command into the stor
CLI:
$ echo "hello world" | stor cp - s3://my/file1
The user can also output a path’s contents to stdout
using the cat
subcommand:
$ stor cat s3://my/file1
hello world
Direct file transfer between OBS services is not yet supported, and within one OBS service (server-side copy) is only supported for DX.