Data ONTAP® PowerShell Toolkit

Switch to Data ONTAP 7-mode documentation.

Cmdlet: Write-NcFile


NAME
Write-NcFile

SYNOPSIS
Write data into a named file.

SYNTAX
Write-NcFile [-Path] <String> -Data <String[]> [-NoClobber] [-Append] [-Appe
ndLine] [-NoTruncate] [-Separator <String>] [-VserverContext <String>] [-Con
troller <NcController[]>] [-Offset <Int64>] [<CommonParameters>]

Write-NcFile [-Path] <String> -RawData <Byte[]> [-NoClobber] [-Append] [-App
endLine] [-NoTruncate] [-VserverContext <String>] [-Controller <NcController
[]>] [-Offset <Int64>] [<CommonParameters>]


DESCRIPTION
Write data into a named file. If the file does not previously exist, it wi
ll be created; the owner of the file will be root and it will not be readabl
e or writable by non-root users. This cmdlet is limited to transfers of 1 M
B and should only be used on normal files. The results for other file types
such as LUNs is undefined.


PARAMETERS
-Path <String>
Pathname of the file to write. For example: "/vol/<volume>/<file>".

Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Data <String[]>
ASCII text to be written to the file.

Required? true
Position? named
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

-NoClobber
If specified, file will not be overwritten if it exists.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Append
If specified, file will be appended to. Ignored if Offset is specified.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-AppendLine
If specified, file will be appended to on a new line. Ignored if Offset
is specified.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-NoTruncate
If specified, file will not be truncated before being written to. Ignor
ed if non-zero Offset if specified.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Separator <String>
Separator used between lines of input. May be an empty string. Default
is a newline (`n).

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-VserverContext <String>
Vserver to which to direct this command. If the currently connected con
troller (as embodied by an NcController object) represents a cluster, th
ere are multiple means to address commands to one of its vservers. Eith
er set the Vserver field on the NcController object to direct all subseq
uent commands to that vserver, or supply the VserverContext parameter to
an individual cmdlet. Only cmdlets which may be invoked on vservers of
fer the VserverContext parameter.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Controller <NcController[]>
A Data ONTAP cluster-mode controller to receive this cmdlet, as embodied
by an NcController object. This parameter is returned by the Connect-N
cController cmdlet. If not specified, the value in the global variable
CurrentNcController is used. In the latter case, if CurrentNcController
contains a collection of NcController objects, this cmdlet is invoked o
n each controller in succession.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

-Offset <Int64>
Offset into file at which to start writing.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-RawData <Byte[]>
Array of bytes to be written to the file.

Required? true
Position? named
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS



NOTES


Category: file
API: file-write-file, file-truncate-file
Family: vserver

-------------- Example 1 --------------

C:\PS>Write-NcFile /vol/vol1/hosts -RawData (Get-Content c:\windows\system32
\drivers\etc\hosts -Encoding byte)


Copy a file from the local host to a new file on a vserver. This example wo
rks for any file, text or binary.






RELATED LINKS
Read-NcFile







 Data ONTAP® PowerShell Toolkit