alpacon cp
Copy files between your local machine and remote servers.
Usage
alpacon cp SOURCE... DESTINATION [flags]
Key facts
- Remote paths use
[USER@]SERVER:/path. - Pass multiple sources before the destination.
- Use
--work-sessionto select a session explicitly.
Flags
| Flag | Type | Description | Default |
|---|---|---|---|
-g, --groupname | string | Specify groupname | — |
-h, --help | bool | help for cp | false |
-n, --no-overwrite | bool | Do not overwrite existing files on the server | false |
-r, --recursive | bool | Recursively copy directories | false |
-u, --username | string | Specify username | — |
--work-session | string | Attach this transfer to a work-session (overrides ‘work-session use’) | — |
--output | string | Output format: table or json | table |
Examples
Upload files to a remote server
alpacon cp /local/file1.txt /local/file2.txt my-server:/remote/path/Upload or download a directory
alpacon cp -r /local/directory my-server:/remote/path/
alpacon cp -r my-server:/remote/directory /local/path/Download a file from a remote server
alpacon cp my-server:/remote/file.txt /local/path/Upload without overwriting existing files
alpacon cp --no-overwrite /local/file.txt my-server:/remote/path/Specify username with SSH-like syntax
alpacon cp /local/file.txt admin@my-server:/remote/path/
alpacon cp -r admin@my-server:/var/log/ /local/logs/Specify username with flag
alpacon cp -u admin /local/file.txt my-server:/remote/path/Specify groupname
alpacon cp -g developers /local/file.txt my-server:/remote/path/Attach the transfer to a specific work session
alpacon cp /local/file.txt my-server:/remote/path/ --work-session 11111111-2222-3333-4444-555555555555Details
Copy files between your local machine and a remote server. Supports SSH-like user@host:path syntax for specifying the username inline with the remote path.
Remote paths use the format [USER@]SERVER:/path.
To edit a single remote file in place instead of copying it back and forth, see alpacon edit.
Work session requirement
When you sign in with browser login, alpacon cp requires an active work session that includes the webftp scope. Service-token authentication bypasses this requirement. The token still needs a server ACL entry allowing the target server and a file ACL entry allowing the path: upload to send a file, download to fetch it, and both (or *) for edit.
New personal API tokens cannot hold command-execution or file-transfer scopes. Existing tokens with those scopes keep working without a work session. Use a service token for automation and CI.
The session to attach is resolved from the --work-session flag, the ALPACON_WORK_SESSION environment variable, or the active session set with alpacon work-session use—in that order. When the gate denies a transfer, cp exits with code 3; run with --output json to get a machine-readable diagnostic on stderr. See Gate errors for the error codes.
Temporary directory requirement
When transferring multiple files at once or using the -r flag to transfer directories, the server compresses the target files into a ZIP archive before transfer. This archive is created in the server’s system temporary directory (/tmp on Linux, $TMPDIR (falling back to /tmp) on macOS, %TEMP% on Windows).
On Linux servers where /tmp is mounted as a small tmpfs, large transfers may fail due to insufficient space. Ensure the server has enough temporary-directory space for the files being transferred.