View Full Version : Get file owner
01-31-2009, 12:23 AM
I wanted to get the owner of an external file inside maxscript. Is that possible? I can see one can use "getFileAttribute", "getFileSize", and other things, but not get the owner of the file?
Any suggestions please.
01-31-2009, 04:50 AM
by 'owner', do you mean the 'author' in the file's Summary info?
If so, see the '3ds Max Scene File Properties' topic; that only applies to the currently open 3ds Max scene file, however.
For DLLs, EXEs, etc. you could use .net's "System.Diagnostics.FileVersionInfo"
For Summary Info on arbitrary files, it looks like you might be in a bit of a pickle - might be a .net assembly out there that gives easy access :)
02-03-2009, 12:48 AM
By "owner", i mean the person who owns permissions to the file, or the one who created it. It doesn't have to be a max file.
02-03-2009, 02:30 AM
fn getFileOwner f = (
local fileInfo = dotNetObject "System.IO.FileInfo" f
local fileAccessControl = fileInfo.getAccessControl()
local NTAccountType = dotNetClass "System.Security.Principal.NTAccount"
local fileOwner = fileAccessControl.getOwner NTAccountType
f = "c:\\divx.log"
And while your at it, please lock this file for others, make a revision copy in a maxscript based versioning system and have it work network wide.... in 10 lines of code... but don't worry it only has to be done by afternoon tomorrow, so plenty of time I reckon!
02-04-2009, 01:44 PM
And while your at it...
It can be all yours for the minor sum of... *puts pinkie to mouth*
I think there was another thread here somewhere about locking files - I don't think that went anywhere, did it?
MaxScript -does- have a versioning system added via CVS/Subversion and such, so you could leverage that... if it were available as a function somewhere.. I'm only seeing it as a menu option. But I guess you can always call the version control software manually :)
10 lines is the easy part - as long as you allow ; :)
02-04-2009, 11:59 PM
Thanks zeboxx. Problem solved. Thanks guys, for all your posts.
02-04-2009, 11:59 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.