/// <summary> /// Modify the permissions of the given file/folder. /// Only works on *NIX systems, and not on Windows/IIS servers. /// Only works if the FTP server supports the SITE CHMOD command /// (requires the CHMOD extension to be installed and enabled). /// Throws FtpCommandException if there is an issue. /// </summary> /// <param name="path">The full or relative path to the item</param> /// <param name="owner">The owner permissions</param> /// <param name="group">The group permissions</param> /// <param name="other">The other permissions</param> public void SetFilePermissions(string path, FtpPermission owner, FtpPermission group, FtpPermission other) { SetFilePermissions(path, FtpExtensions.CalcChmod(owner, group, other)); }
/// <summary> /// Modify the permissions of the given file/folder. /// Only works on *NIX systems, and not on Windows/IIS servers. /// Only works if the FTP server supports the SITE CHMOD command /// (requires the CHMOD extension to be installed and enabled). /// Throws FtpCommandException if there is an issue. /// </summary> /// <param name="path">The full or relative path to the item</param> /// <param name="owner">The owner permissions</param> /// <param name="group">The group permissions</param> /// <param name="other">The other permissions</param> /// <param name="token">The token that can be used to cancel the entire process</param> public Task SetFilePermissionsAsync(string path, FtpPermission owner, FtpPermission group, FtpPermission other, CancellationToken token = default(CancellationToken)) { return(SetFilePermissionsAsync(path, FtpExtensions.CalcChmod(owner, group, other), token)); }
/// <summary> /// Calculates the CHMOD value from the permissions flags /// </summary> public static void CalculateChmod(this FtpListItem item) { item.Chmod = FtpExtensions.CalcChmod(item.OwnerPermissions, item.GroupPermissions, item.OthersPermissions); }