has anybody succeeded in getting a files owner or group?
E.g. user "jamirokwai" and group "homezone" or such?
Thanks in advance for some hints

Edit: getting file-attributes is rather easy, but owner/group...
Code: Select all
Structure stat64
st_dev.w ; /* ID of device containing file */
st_mode.i ; /* Mode of file */
st_nlink.i ; /* Number of hard links */
st_ino.w ; /* File serial number */
st_uid.i ; /* User ID of the file */
st_gid.i ; /* Group ID of the file */
st_rdev.i ; /* Device ID */
st_atimespec.q ; /* time of last access */
st_mtimespec.q ; /* time of last data modification */
st_ctimespec.q ; /* time of last status change */
st_birthtimespec.q ; /* time of file creation(birth) */
st_size.i ; /* file size, in bytes */
st_blocks.i ; /* blocks allocated for file */
st_blksize.i ; /* optimal blocksize for I/O */
st_flags.i ; /* user defined flags for file */
st_gen.i ; /* file generation number */
st_lspare.i ; /* RESERVED: DO NOT USE! */
st_qspare.q[2] ; /* RESERVED: DO NOT USE! */
EndStructure
Structure passwd
pw_name.s ; /* user name */
pw_passwd.s ; /* encrypted password */
pw_uid.i ; /* user uid */
pw_gid.i ; /* user gid */
pw_change.i ; /* password change time */
pw_class.s ; /* user access class */
pw_gecos.s ; /* Honeywell login info */
pw_dir.s ; /* home directory */
pw_shell.s ; /* default shell */
pw_expire.i ; /* account expiration */
pw_fields.i ; /* internal: fields filled in */
EndStructure
;ImportC "/usr/lib/libc.dylib"
; stat.l(s.s, *buf)
; getpwuid(*uid)
;EndImport
buf.stat64
*pwd.passwd
; place your own path to file/folder here
err.l=stat_("/Users/riveraa/Library",@buf)
Debug buf\st_uid ; USER ID of file's owner
Debug buf\st_gid ; GROUP ID with rights to file
*pwd=getpwuid_(buf\st_uid) ; pass uid to function
Debug *pwd\pw_name ; user's shortname
Debug *pwd\pw_uid ; confirms correct uid
Code: Select all
ImportC ""
stat64(path.p-ascii, *buf)
getpwuid(uid)
getgrgid(gid)
EndImport
Structure timespec
tv_sec.i
tv_nsec.i
EndStructure
Structure stat64
st_dev.l; /* ID of device containing file */
st_mode.w; /* Mode of file */
st_nlink.w; /* Number of hard links */
st_ino.q; /* File serial number */
st_uid.l; /* User ID of the file */
st_gid.l; /* Group ID of the file */
st_rdev.i; /* Device ID */
st_atimespec.timespec; /* time of last access */
st_mtimespec.timespec; /* time of last data modification */
st_ctimespec.timespec; /* time of last status change */
st_birthtimespec.timespec; /* time of file creation(birth) */
st_size.q; /* file size, in bytes */
st_blocks.q; /* blocks allocated for file */
st_blksize.l; /* optimal blocksize for I/O */
st_flags.l; /* user defined flags for file */
st_gen.l; /* file generation number */
st_lspare.l; /* RESERVED: DO NOT USE! */
st_qspare.q[2]; /* RESERVED: DO NOT USE! */
EndStructure
stat64("MyFile", @stats.stat64)
Debug "File size : " + Str(stats\st_size)
Debug "User name : " + PeekS(PeekI(getpwuid(stats\st_uid)), -1, #PB_Ascii)
Debug "Group name : " + PeekS(PeekI(getgrgid(stats\st_gid)), -1, #PB_Ascii)
Debug "Last access : " + FormatDate("%yyyy/%mm/%dd", stats\st_atimespec\tv_sec)