Back to product page

SetAttributes method


Type

Void

Syntax

  • C#
  • VB.NET
public Void SetAttributes(Int64 Permissions);
The SetAttributes(Permissions) syntax has these parts:
PermissionsSets file or directory permissions.

public Void SetAttributes(UInt64 Size);
The SetAttributes(Size) syntax has these parts:
SizeNew file size. You can truncate file to 0, or set it to any size of your choice.

public Void SetAttributes(Int64 Uid, Int64 Gid);
The SetAttributes(Uid,Gid) syntax has these parts:
UidSets user owner for the file or directory.
GidSets group owner for the file or directory.

public Void SetAttributes(DateTime AccessTime, DateTime ModificationTime);
The SetAttributes(AccessTime,ModificationTime) syntax has these parts:
AccessTimeSets last access time.
ModificationTimeSets last modification time.

public Void SetAttributes(String RemotePath, Int64 Permissions);
The SetAttributes(RemotePath,Permissions) syntax has these parts:
RemotePathFull path to file on remote server whose attributes should be set.
PermissionsSets file or directory permissions.

public Void SetAttributes(String RemotePath, UInt64 Size);
The SetAttributes(RemotePath,Size) syntax has these parts:
RemotePathFull path to file on remote server whose attributes should be set.
SizeNew file size. You can truncate file to 0, or set it to any size of your choice.

public Void SetAttributes(String RemotePath, Int64 Uid, Int64 Gid);
The SetAttributes(RemotePath,Uid,Gid) syntax has these parts:
RemotePathFull path to file on remote server whose attributes should be set.
UidSets user owner for the file or directory.
GidSets group owner for the file or directory.

public Void SetAttributes(String RemotePath, DateTime AccessTime, DateTime ModificationTime);
The SetAttributes(RemotePath,AccessTime,ModificationTime) syntax has these parts:
RemotePathFull path to file on remote server whose attributes should be set.
AccessTimeSets last access time.
ModificationTimeSets last modification time.

public Void SetAttributes(UInt64 Size, Int64 Uid, Int64 Gid, Int64 Permissions, DateTime AccessTime, DateTime ModificationTime);
The SetAttributes(Size,Uid,Gid,Permissions,AccessTime,ModificationTime) syntax has these parts:
SizeNew file size. You can truncate file to 0, or set it to any size of your choice.
UidSets user owner for the file or directory.
GidSets group owner for the file or directory.
PermissionsSets file or directory permissions.
AccessTimeSets last access time.
ModificationTimeSets last modification time.

public Void SetAttributes(String RemotePath, UInt64 Size, Int64 Uid, Int64 Gid, Int64 Permissions, DateTime AccessTime, DateTime ModificationTime);
The SetAttributes(RemotePath,Size,Uid,Gid,Permissions,AccessTime,ModificationTime) syntax has these parts:
RemotePathFull path to file on remote server whose attributes should be set.
SizeNew file size. You can truncate file to 0, or set it to any size of your choice.
UidSets user owner for the file or directory.
GidSets group owner for the file or directory.
PermissionsSets file or directory permissions.
AccessTimeSets last access time.
ModificationTimeSets last modification time.

public Sub SetAttributes(ByVal Permissions As Int64)
The SetAttributes(Permissions) syntax has these parts:
PermissionsSets file or directory permissions.

public Sub SetAttributes(ByVal Size As UInt64)
The SetAttributes(Size) syntax has these parts:
SizeNew file size. You can truncate file to 0, or set it to any size of your choice.

public Sub SetAttributes(ByVal Uid As Int64, ByVal Gid As Int64)
The SetAttributes(Uid,Gid) syntax has these parts:
UidSets user owner for the file or directory.
GidSets group owner for the file or directory.

public Sub SetAttributes(ByVal AccessTime As DateTime, ByVal ModificationTime As DateTime)
The SetAttributes(AccessTime,ModificationTime) syntax has these parts:
AccessTimeSets last access time.
ModificationTimeSets last modification time.

public Sub SetAttributes(ByVal RemotePath As String, ByVal Permissions As Int64)
The SetAttributes(RemotePath,Permissions) syntax has these parts:
RemotePathFull path to file on remote server whose attributes should be set.
PermissionsSets file or directory permissions.

public Sub SetAttributes(ByVal RemotePath As String, ByVal Size As UInt64)
The SetAttributes(RemotePath,Size) syntax has these parts:
RemotePathFull path to file on remote server whose attributes should be set.
SizeNew file size. You can truncate file to 0, or set it to any size of your choice.

public Sub SetAttributes(ByVal RemotePath As String, ByVal Uid As Int64, ByVal Gid As Int64)
The SetAttributes(RemotePath,Uid,Gid) syntax has these parts:
RemotePathFull path to file on remote server whose attributes should be set.
UidSets user owner for the file or directory.
GidSets group owner for the file or directory.

public Sub SetAttributes(ByVal RemotePath As String, ByVal AccessTime As DateTime, ByVal ModificationTime As DateTime)
The SetAttributes(RemotePath,AccessTime,ModificationTime) syntax has these parts:
RemotePathFull path to file on remote server whose attributes should be set.
AccessTimeSets last access time.
ModificationTimeSets last modification time.

public Sub SetAttributes(ByVal Size As UInt64, ByVal Uid As Int64, ByVal Gid As Int64, ByVal Permissions As Int64, ByVal AccessTime As DateTime, ByVal ModificationTime As DateTime)
The SetAttributes(Size,Uid,Gid,Permissions,AccessTime,ModificationTime) syntax has these parts:
SizeNew file size. You can truncate file to 0, or set it to any size of your choice.
UidSets user owner for the file or directory.
GidSets group owner for the file or directory.
PermissionsSets file or directory permissions.
AccessTimeSets last access time.
ModificationTimeSets last modification time.

public Sub SetAttributes(ByVal RemotePath As String, ByVal Size As UInt64, ByVal Uid As Int64, ByVal Gid As Int64, ByVal Permissions As Int64, ByVal AccessTime As DateTime, ByVal ModificationTime As DateTime)
The SetAttributes(RemotePath,Size,Uid,Gid,Permissions,AccessTime,ModificationTime) syntax has these parts:
RemotePathFull path to file on remote server whose attributes should be set.
SizeNew file size. You can truncate file to 0, or set it to any size of your choice.
UidSets user owner for the file or directory.
GidSets group owner for the file or directory.
PermissionsSets file or directory permissions.
AccessTimeSets last access time.
ModificationTimeSets last modification time.

Remarks

SetAttributes method is used to set certain attributes for the file or directory on the server. If RemotePath is not set, then RemotePath property will be used as file/directory name whose attributes are set. IMPORTANT thing to remember is: if you set file UID, set GID also in same function call (and vice versa). This is the way of setting attributes work. Same applies to setting AccessTime and ModificationTime. If you omit any of these parameters (and set the other one), it will be set to 0 (representing Jan 1, 1970). If you want to set only one of these parameters, you should first retrieve file/directory attributes and use those values in this method.

The value for Permissions is defined by POSIX standard, meaning (in short) the following: - you should represent them in octal base system (base 8) to parse them easier. Permissions AND 777 (octal) will give you read/write/execute permissions for owner, group and others. To be more precise, 1 means execute permission, 2 means write permission, 4 means read permission. For example, if file Permission AND 777 (octal) is 754, this is represented on the server as -rwxr-xr-- which means following: owner can read/write/execute, group can read/execute, and others can only read. To determine if attribute belongs to directory, test for Permissions AND 40000 (octal). To determine if attribute belongs to symbolic link, test for Permissions AND 120000 (octal).

Platforms

Windows