doyle.jack Posted April 7, 2005 Share Posted April 7, 2005 Does anyone know of a function that I could use to get the owner of a file? I know that using built in functions I can provide a path/filename and get the different dates, size, attributes, etc. But how could I find out the owner of the file? This is on an NTFS formatted drive. Link to comment Share on other sites More sharing options...
Ejoc Posted April 7, 2005 Share Posted April 7, 2005 I dont think you can get it w/ any built in feature (I could easily be wrong but I didn't find any reference to it), *but you could do a DIR /Q 'filename' > temp.txt and parse the temp file. Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
doyle.jack Posted April 7, 2005 Author Share Posted April 7, 2005 I dont think you can get it w/ any built in feature (I could easily be wrong but I didn't find any reference to it), *but you could do a DIR /Q 'filename' > temp.txt and parse the temp file.<{POST_SNAPBACK}>Thanks. I'm not sure of an easy way to parse the file, though. Link to comment Share on other sites More sharing options...
Ejoc Posted April 7, 2005 Share Posted April 7, 2005 This worked for me: MsgBox(0,"",GetOwner("C:\AUTOEXEC.BAT")) Func GetOwner($filename) Local $a, $s, $tmpfile = @TEMPDir & '\getowner.txt' Run(@ComSpec & ' /c DIR /Q "' & $filename & '" > ' & $tmpfile,"",@SW_MINIMIZE) $s = FileReadLine($tmpfile,6) FileDelete($tmpfile) if $s = "" or @error Then return "" $s = StringStripWS($s,4) $a = StringSplit($s," ") if $a[0] >= 5 Then Return $a[5] return "" EndFunc Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
Ejoc Posted April 7, 2005 Share Posted April 7, 2005 "Works" is interesting... 1) If the file is supplied via UNC \\server\dir\file Dir translates the owner to '...' in a Workgroup setting, unsure about an Active Directory Domain 2) If the file is a mapped network drive the Computer name is set to the local machine not the remote machine. I have files on a server w/ the ownership SERVER1\USER but DIR says it's LOCALCOMPUTER\USER Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now