Parallel Works

pw buckets cp

pw buckets cp

Copy files between local and buckets

Synopsis

The pw buckets cp command must be followed by a source and a destination. The source and destination can be either a local file or a bucket URI.

Both PW URIs and CSP URIs are accepted. For more information about URIs, please see this section.

When copying to/from a bucket with a PW URI, you must specify at least the bucket name. However, paths can be longer, such as pw://[namespace]/[bucket-name]/[folder]/[folder2]/[folder3]/[file-name].

Recursive copies follow the same trailing slash rule as cp and rsync: a source without a trailing slash copies the directory itself, and a source with a trailing slash copies its contents. This holds in both directions.

Transfer progress is drawn as a bar only when the terminal is attached. When output is redirected, such as inside a workflow step, each transfer reports newline-terminated progress lines instead, so the run log stays readable. Pass -o text to force those lines on a terminal too.

pw buckets cp [source] [destination] [flags]

Examples

  pw buckets cp sample.txt pw://demo/demos3bucket
  
  # Download a file named sample.txt to a local file
  pw buckets cp pw://demo/demos3bucket/sample.txt sample2.txt
  
  # Download a file from Azure Blob Storage to a local folder, using the Azure URI
  pw buckets cp https://azuredemo.blob.core.windows.net/azuredemo/sample.txt sample2.txt
  
  # Recursive download of a folder, keeping the folder
  # Result: ./downloads/sample-dir/a.txt, ./downloads/sample-dir/sub/b.txt, ...
  pw buckets cp -r pw://demo/demos3bucket/sample-dir ./downloads
  
  # Recursive download of a folder's contents, with a trailing slash
  # Result: ./downloads/a.txt, ./downloads/sub/b.txt, ...
  pw buckets cp -r pw://demo/demos3bucket/sample-dir/ ./downloads
  
  # Recursive download of the entire bucket root into a local folder
  # Result: ./downloads/<all objects from bucket root...>
  pw buckets cp -r pw://demo/demos3bucket ./downloads/
  
  # Recursive upload of a folder, keeping the folder
  # Result: pw://demo/demos3bucket/uploads/sample-dir/a.txt, ...
  pw buckets cp -r ./sample-dir pw://demo/demos3bucket/uploads
  
  # Recursive upload of a folder's contents, with a trailing slash
  # Result: pw://demo/demos3bucket/uploads/a.txt, ...
  pw buckets cp -r ./sample-dir/ pw://demo/demos3bucket/uploads
  
  # Report progress as plain lines instead of a bar, even on a terminal
  pw buckets cp -o text pw://demo/demos3bucket/data.tar ./data.tar

Options

  -h, --help            help for cp
  -o, --output string   Output format (interactive, text) (default "interactive")
  -r, --recursive       Copy directories/prefixes recursively

Options inherited from parent commands

      --context string         The context to use. Overrides PW_CONTEXT environment variable and current context from config.
      --platform-host string   The Parallel Works ACTIVATE platform host to use. Overrides PW_PLATFORM_HOST environment variable and the current context's server.
  -v, --verbose                Enable verbose logging

SEE ALSO