Edit

Share via


New-AzStorageFileHardLink

Creates a hard link to a file in same share. Only works in NFS file share.

Syntax

New-AzStorageFileHardLink
   [-ShareName] <String>
   [-Path] <String>
   [-TargetFile] <String>
   [-TargetFileLeaseId <String>]
   [-Context <IStorageContext>]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [<CommonParameters>]
New-AzStorageFileHardLink
   [-ShareClient] <ShareClient>
   [-Path] <String>
   [-TargetFile] <String>
   [-TargetFileLeaseId <String>]
   [-Context <IStorageContext>]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [<CommonParameters>]
New-AzStorageFileHardLink
   [-ShareDirectoryClient] <ShareDirectoryClient>
   [-Path] <String>
   [-TargetFile] <String>
   [-TargetFileLeaseId <String>]
   [-Context <IStorageContext>]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [<CommonParameters>]

Description

The New-AzStorageFileHardLink cmdlet creates a hard link to a file in same share. Only works in NFS file share.

Examples

New-AzStorageFileHardLink -ShareName "fileshare1" -Path "folde1/link1" -TargetFile "folde2/folder3/file1"

This command creates a hard link with path "folde1/link1" to a file with path "folde2/folder3/file1" in same share. The new created hardlink will show Length as 0 in Powershell. If you get its properties with Get-AzStorageFile, will get the length of the target file.

Parameters

-ClientTimeoutPerRequest

The client side maximum execution time for each request in seconds.

Type:Nullable<T>[Int32]
Aliases:ClientTimeoutPerRequestInSeconds
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ConcurrentTaskCount

The total amount of concurrent async tasks. The default value is 10.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Context

Azure Storage Context Object

Type:IStorageContext
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Path

Path of the hard link to be created.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ServerTimeoutPerRequest

The server time out for each request in seconds.

Type:Nullable<T>[Int32]
Aliases:ServerTimeoutPerRequestInSeconds
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ShareClient

ShareClient object indicated the share where the files/directories would be listed.

Type:ShareClient
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ShareDirectoryClient

ShareDirectoryClient object indicated the base folder where the files/directories would be listed.

Type:ShareDirectoryClient
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ShareName

Name of the file share where the directory would be created.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-TargetFile

Path of the file to create the hard link to, not including the share. For example:"targetDirectory/targetSubDirectory/.../targetFile". The target file must be in the same share and hence the same storage account.

Type:String
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-TargetFileLeaseId

If the target file has an active lease, specify the lease ID of the target file with this parameter.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

ShareClient

ShareDirectoryClient

String

IStorageContext

Outputs

AzureStorageFile