ydcmd(1)

NAME
ydcmd - command line client for interacting with cloud storage Yandex.Disk by means of REST API.

SYNTAX
ydcmd [command] [options] [args]

COMMANDS

help
    Returns brief info on application's commands and options.

ls  Returns a list of files and directories.

rm  Deletes a file or directory.

cp  Copies a file or directory.

mv  Moves a file or directory.

put Uploads a file or directory into the storage.

get Retrieves a file or directory from the storage.

cat Display a file from the storage to stdout.

mkdir
    Creates a directory.

stat
    Returns meta-information about an object.

info
    Returns meta-information about a storage.

last
    Returns meta-information about last uploaded files.

share
    Publish uploaded object (obtaining direct link).

revoke
    Unpublish uploaded object.

du  Evaluates the disk space used by files within the storage.

clean
    Cleans files and directories.

restore
    Restores file or directory from trash.

download
    Download file from internet to storage.

token
    Get OAuth token for application.

OPTIONS

--config=<S>
    Config filename (if not default).

--timeout=<N>
    Timeout (in seconds) for establishing a network connection.

--retries=<N>
    Number of attempts of API method invocation before returning an error code.

--delay=<N>
    Timeout (in seconds) between attempts of API method invocation.

--limit=<N>
    The number of items returned after a single invocation of a method for obtaining a list of files and directories.

--token=<S>
    OAuth token (for security purposes, should be specified in the configuration file or through an environment variable YDCMD_TOKEN). Instructions on obtaining a debugging token can be found on the following page http://api.yandex.com/oauth/doc/dg/tasks/get-oauth-token.xml.

--quiet
    Error output suppression.

--verbose
    Returns expanded information.

--debug
    Returns debug information.

--chunk=<N>
    Data block size (in KB) for I/O operations.

--ca-file=<S>
    File name with certificates of trusted certification authorities (if the value is null, certificate validation is not performed).

--ciphers=<S>
    Set of encryption algorithms (see ciphers(1)).

--version
    Print version and exit.

ADDITIONAL OPTIONS

  ls

--human
    Returns file size (in human-readable form).

--short
    Returns a list of files and directories without additional information (one name per line).

--long
    Returns an extended list (creation time, modification time, size, file name).

If a target object is not specified, then the storage's root directory will be used.

  rm

--trash
    Remove to trash folder.

--poll=<N>
    Interval (in seconds) between status polls during an asynchronous operation.

--async
    Runs a command without waiting for operation to terminate (poll).

Files are deleted permanently. Directories are deleted recursively (including sub files and sub directories).

  cp

--poll=<N>
    Interval (in seconds) between status polls during an asynchronous operation.

--async
    Runs a command without waiting for operation to terminate (poll).

In case of name coincidence, directories and files will be overwritten. Directories are copied recursively (including sub folders and sub directories).

  mv

--poll=<N>
    Interval (in seconds) between status polls during an asynchronous operation.

--async
    Runs a command without waiting for operation to terminate (poll).

In case of name coincidence, directories and files will be overwritten.

  put

--rsync
    Synchronizes a tree of files and directories in the storage with a local tree.

--no-recursion
    Avoid descending automatically in directories.

--no-recursion-tag=<S>
    Avoid descending in directories containing file.

--exclude-tag=<S>
    Exclude contents of directories containing file.

--skip-hash
    Skip md5/sha256 integrity checks.

--threads=<N>
    Number of worker processes.

--iconv=<S>
    Try to restore file or directory names from the specified encoding if necessary (for example cp1250).

--progress
    Show progress (it is recommended to install python-progressbar module).

If a target object is not specified, then the storage's root directory will be used for uploading a file. If a target object denotes a directory (ends with '/'), then the source file name will be added to the directory's name. If a target object exists, it will be overwritten without a confirmation prompt. Symbolic links are ignored.

  get

--rsync
    Synchronizes a local tree of files and directories with a tree in the storage.

--no-recursion
    Avoid descending automatically in directories.

--skip-hash
    Skip md5/sha256 integrity checks.

--threads=<N>
    Number of worker processes.

--progress
    Show progress (it is recommended to install python-progressbar module).

If the target file's name is not specified, the file's name within the storage will be used. If a target object exists, it will be overwritten without a confirmation prompt.

  info

--long
    Returns sizes in bytes instead of human-readable form.

  last

--human
    Returns file size (in human-readable form).

--short
    Returns a list of files without additional information (one name per line).

--long
    Returns an extended list (creation time, modification time, size, file name).

If argument N is not specified, default REST API value will be used.

  du

--depth=<N>
    Returns the sizes of directories up to the level N.

--long
    Returns sizes in bytes instead of human-readable form.

If a target object is not specified, then the storage's root directory will be used.

  clean

--dry
    Returns a list of objects for removal, instead of deleting.

--type=<S>
    The type of objects for removal ('file' - files, 'dir' - directories, 'all' - all).

--keep=<S>
    Value of selection criteria related to objects to be saved:
    * A date string in ISO format can be used to select a date up to which you want to delete the data (for example, '2014-02-12T12:19:05+04:00');
    * For selecting a relative time, you can use a number and a dimension (for example, '7d', '4w', '1m', '1y');
    * For selecting the number of copies, you can use a number without a dimension (for example, '31').

  restore

--poll=<N>
    Interval (in seconds) between status polls during an asynchronous operation.

--async
    Runs a command without waiting for operation to terminate (poll).

In case of name coincidence, directories and files will be overwritten. Directories are restored recursively (including sub folders and sub directories).

  download

--poll=<N>
    Interval (in seconds) between status polls during an asynchronous operation.

--async
    Runs a command without waiting for operation to terminate (poll).

--no-redirects
    Disable redirects.

If target is not specified, target will be root '/' directory with file name extracted from URL (if possible).

CONFIGURATION

For convenience, we recommend creating a configuration file named ~/.ydcmd.cfg and granting it file permissions 0600 or 0400. File format:

    [ydcmd]
    # comment
    <option> = <value>

For example:

    [ydcmd]
    token = 1234567890
    verbose = yes
    ca-file = /etc/ssl/certs/ca-certificates.crt

ENVIRONMENT VARIABLES

YDCMD_TOKEN
    OAuth token. Has priority over the option --token.

SSL_CERT_FILE
    File name with certificates of trusted certification authorities. Has priority over the option --ca-file.

EXIT CODE

0   Successful completion.

1   General application error.

4   HTTP status code 4xx (client error).

5   HTTP status code 5xx (server error).