## zowe › zos-files › upload › dir-to-uss

Upload a local directory to a USS directory.

An optional .zosattributes file in the source directory can be used to control file conversion and tagging.

An example .zosattributes file:
# pattern local-encoding remote-encoding
# Don't upload the node_modules directory
node_modules -
# Don't upload files that start with periods
.* -
# Upload jpg images in binary
*.jpg binary binary
# Convert CICS Node.js profiles to EBCDIC
*.profile ISO8859-1 EBCDIC

Lines starting with the ‘#’ character are comments. Each line can specify up to three positional attributes:

- A pattern to match a set of files. Pattern-matching syntax follows the same rules as those that apply in .gitignore files (note that negated patterns that begin with ‘!’ are not supported). See https://git-scm.com/docs/gitignore#_pattern_format.
- A local-encoding to identify a file’s encoding on the local workstation. If '-' is specified for local-encoding,files that match the pattern are not transferred.
- A remote-encoding to specify the file’s desired character set on USS. This attribute must either match the local encoding or be set to EBCDIC. If set to EBCDIC, files are transferred in text mode and converted, otherwise they are transferred in binary mode. Remote files are tagged either with the remote encoding or as binary.

A .zosattributes file can either be placed in the top-level directory you want to upload, or its location can be specified by using the --attributes parameter. .zosattributes files that are placed in nested directories are ignored.

#### Usage

zowe zos-files upload dir-to-uss <inputDir> <USSDir> [options]

#### Positional Arguments

- `inputDir` (string)

  - The local directory path that you want to upload to a USS directory

- `USSDir` (string)

  - The name of the USS directory to which you want to upload the local directory

#### Options

- `--binary` | `-b` (boolean)

  - Data content in binary mode, which means that no data conversion is performed. The data transfer process returns each record as-is, without translation. No delimiters are added between records.

- `--recursive` | `-r` (boolean)

  - Upload all directories recursively.

- `--binary-files` | `--bf` (string)

  - Comma separated list of file names to be uploaded in binary mode. Use this option when you upload a directory in default ASCII mode, but you want to specify certain files to be uploaded in binary mode. All files matching specified file names will be uploaded in binary mode. If a .zosattributes file (or equivalent file specified via --attributes) is present, --binary-files will be ignored.

- `--ascii-files` | `--af` (string)

  - Comma separated list of file names to be uploaded in ASCII mode. Use this option when you upload a directory with --binary/-b flag, but you want to specify certain files to be uploaded in ASCII mode. All files matching specified file names will be uploaded in ASCII mode. If a .zosattributes file (or equivalent file specified via --attributes) is present, --ascii-files will be ignored.

- `--attributes` | `--attrs` (string)

  - Path of an attributes file to control how files are uploaded

- `--max-concurrent-requests` | `--mcr` (number)

  - Specifies the maximum number of concurrent z/OSMF REST API requests to upload files. Increasing the value results in faster uploads. However, increasing the value increases resource consumption on z/OS and can be prone to errors caused by making too many concurrent requests. If the upload process encounters an error, the following message displays:
    The maximum number of TSO address spaces have been created. When you specify 0, Zowe CLI attempts to upload all members at once without a maximum number of concurrent requests.

    Default value: 1

- `--include-hidden` | `--ih` (boolean)

  - Include hidden files and folders that have names beginning with a dot

- `--response-timeout` | `--rto` (number)

  - The maximum amount of time in seconds the z/OSMF Files TSO servlet should run before returning a response. Any request exceeding this amount of time will be terminated and return an error. Allowed values: 5 - 600

#### Zosmf Connection Options

- `--host` | `-H` (string)

  - The z/OSMF server host name.

- `--port` | `-P` (number)

  - The z/OSMF server port.

    Default value: 443

- `--user` | `-u` (string)

  - Mainframe (z/OSMF) user name, which can be the same as your TSO login.

- `--password` | `--pass` | `--pw` (string)

  - Mainframe (z/OSMF) password, which can be the same as your TSO password.

- `--reject-unauthorized` | `--ru` (boolean)

  - Reject self-signed certificates.

    Default value: true

- `--base-path` | `--bp` (string)

  - The base path for your API mediation layer instance. Specify this option to prepend the base path to all z/OSMF resources when making REST requests. Do not specify this option if you are not using an API mediation layer.

- `--protocol` (string)

  - The protocol used (HTTP or HTTPS)

    Default value: https
    Allowed values: http, https

- `--cert-file` (local file path)

  - The file path to a certificate file to use for authentication

- `--cert-key-file` (local file path)

  - The file path to a certificate key file to use for authentication

#### Profile Options

- `--zosmf-profile` | `--zosmf-p` (string)

  - The name of a (zosmf) profile to load for this command execution.

- `--base-profile` | `--base-p` (string)

  - The name of a (base) profile to load for this command execution.

#### Base Connection Options

- `--token-type` | `--tt` (string)

  - The type of token to get and use for the API. Omit this option to use the default token type, which is provided by 'zowe auth login'.

- `--token-value` | `--tv` (string)

  - The value of the token to pass to the API.

#### Examples

- Upload all files from the "local_dir" directory to the "/a/ibmuser/my_dir" USS directory:

  - `zowe zos-files upload dir-to-uss "local_dir" "/a/ibmuser/my_dir"`

- Upload all files from the "local_dir" directory and all its sub-directories, to the "/a/ibmuser/my_dir" USS directory:

  - `zowe zos-files upload dir-to-uss "local_dir" "/a/ibmuser/my_dir" --recursive`

- Upload all files from the "local_dir" directory to the "/a/ibmuser/my_dir" USS directory in default ASCII mode, while specifying a list of file names (without path) to be uploaded in binary mode:

  - `zowe zos-files upload dir-to-uss "local_dir" "/a/ibmuser/my_dir" --binary-files "myFile1.exe,myFile2.exe,myFile3.exe"`

- Upload all files from the "local_dir" directory to the "/a/ibmuser/my_dir" USS directory in binary mode, while specifying a list of file names (without path) to be uploaded in ASCII mode:

  - `zowe zos-files upload dir-to-uss "local_dir" "/a/ibmuser/my_dir" --binary --ascii-files "myFile1.txt,myFile2.txt,myFile3.txt"`

- Recursively upload all files from the "local_dir" directory to the "/a/ibmuser/my_dir" USS directory, specifying files to ignore and file encodings in the local file my_global_attributes:

  - `zowe zos-files upload dir-to-uss "local_dir" "/a/ibmuser/my_dir" --recursive --attributes my_global_attributes`