Data ONTAP® PowerShell Toolkit

Switch to Data ONTAP Cluster-mode documentation.

Cmdlet: Set-NaFileSize


NAME
Set-NaFileSize

SYNOPSIS
Truncate a file.

SYNTAX
Set-NaFileSize [-Path] <String> [[-Size] <String>] [-Controller <NaControlle
r>] [-WhatIf] [-Confirm] [<CommonParameters>]


DESCRIPTION
Truncate a file. Any data past the truncation point will be lost.


PARAMETERS
-Path <String>
Path of the file, i.e. /vol/<volumename>/<filename>.

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

-Size <String>
If provided, the file size is set to this value. The default value is 0.
Specify the file size using the following format:

[+|-]<number>[k|m|g|t|%]

If a leading '+' or '-' appears, it indicates that the file size is to b
e increased or decreased (respectively) by the indicated amount, else th
e amount is the absolute size to set. The optional trailing 'k', 'm', '
g', and 't' indicates the desired units, namely 'kilobytes', 'megabytes'
, 'gigabytes', and 'terabytes' (respectively). The optional trailing '%
' indicates to increase or decrease the size of the file by a percentage
of its current size. If the trailing unit character doesn't appear, th
en <number> is interpreted as the number of bytes desired.

Required? false
Position? 2
Default value 0
Accept pipeline input? false
Accept wildcard characters? false

-Controller <NaController>
The Data ONTAP controller object, embodied by an NaController object. T
his parameter is returned by the Connect-NaController cmdlet. If not sp
ecified, the value in the global variable CurrentNaController is used.

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

-WhatIf


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

-Confirm


Required? false
Position? named
Default value
Accept pipeline input? false
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
DataONTAP.Types.File.FileInfo


NOTES


Category: file
API: file-truncate-file

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

C:\PS>Set-NaFileSize /vol/vol0/etc/testfile


Truncate file 'testfile' in /etc to zero length.


Name : /vol/vol0/etc/testfile
FileType : file
FileSize : 0
CreationTimestampDT : 5/5/2010 8:24:23 PM
ChangedTimestampDT : 8/30/2010 9:21:56 PM
ModifiedTimestampDT : 8/30/2010 9:21:56 PM
AccessedTimestampDT : 5/5/2010 8:24:28 PM
AclType : nt_acl
OwnerId : 0
GroupId : 0
Perm : 1070
HardLinksCount : 1
InodeNumber : 3784340
IsEmpty :


-------------- Example 2 --------------

C:\PS>Set-NaFileSize /vol/vol2/text2.txt +5MB


Increase the size of the file by 5MB.


Name : /vol/vol2/text2.txt
FileType : file
FileSize : 5243904
CreationTimestampDT : 10/6/2011 7:21:17 PM
ChangedTimestampDT : 10/14/2011 6:53:15 PM
ModifiedTimestampDT : 10/14/2011 6:53:15 PM
AccessedTimestampDT : 10/13/2011 3:18:27 PM
AclType : no_acl
OwnerId : 0
GroupId : 0
Perm : 1077
HardLinksCount : 1
InodeNumber : 11196
IsEmpty :



RELATED LINKS
Get-NaFile







 Data ONTAP® PowerShell Toolkit