Object

Write-NetstorageObject

Synopsis

Upload a file to NetStorage.

Syntax

Write-NetstorageObject [-LocalPath] <String> -RemotePath <String> [-MTime <String>] [-Size <String>] [-CheckHash] [-AuthFile <String>] [-Section <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

Description

Uploads a file to NetStorage from your local machine to a remote path. Optionally, you can provide the -Size and -MTime parameters when running this operation. If using the -CheckHash switch parameter, PowerShell will calculate the file hash and provide that to NetStorage to ensure the file is valid upon upload.

Note: You don't need to prepend paths with the upload directory CP code, this is implied.

Parameters

‑AuthFile

A location of your NetStorage auth file. Defaults to ~/.nsrc, but environment variables will take precedence.

‑CheckHash

Includes a sha256 hash of your file with the request, which NetStorage will check.

‑LocalPath
Required

The location of the file you wish to upload.

‑MTime

The desired modification time for the target content using UNIX epoch time.

‑RemotePath
Required

The remote location you wish to upload your file to. The Upload Directory prefix isn't required.

‑Section

The section name in your EdgeGrid resource file to retrieve authentication credentials from. Defaults to default.

‑Size

Enforces that the uploaded file is precisely $Size size (in bytes). The server returns a 412 error for size mismatches.

Related Links