Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: file ownership wntOwnerGet
;################################################################################ ; DisplayOwner.wbt ; A. van den Wollenberg ; ; Creates file-/directorylist with owner ; ;################################################################################ intcontrol(5, 1, 0, 0, 0) ; Also System and Hidden files intcontrol(1002, 0, 0, 0, 0) ; Hide Winbatch icon intcontrol(54, "", 1, 0, 0) ; Stay on top AddExtender("WWWNT34I.DLL") time = getexacttime() tempfilename = strcat(environment("TEMP"), "\DO-", strreplace(time, ":", ""), ".tmp") tempfile = fileopen(tempfilename, "write") wrkdir = AskDirectory("Directory", "", "", "", 0) headerstr = strcat("Contents of Directory ", wrkdir, " :") filewrite(tempfile, headerstr) filewrite(tempfile, strfill("=", strlen(headerstr))) filewrite(tempfile, "%@CRLF%Filename Owner") filewrite(tempfile, "======== =====%@CRLF%") ; Get directory listing dirchange(wrkdir) ; All files and directories, plus extra tabs ;list = strcat(diritemize("*.*"), @TAB, fileitemize("*.*"), @TAB) dirlist = diritemize("*.*") if dirlist <> "" then dirlist = strcat(dirlist, @TAB) filelist = fileitemize("*.*") if filelist <> "" then filelist = strcat(filelist, @TAB) list = strcat(dirlist, filelist) listlen = strlen(list) if listlen == 0 display(2, "DisplayOwner", "No files or directories found") exit endif start = 1 while @TRUE finish = strscan(list, @TAB, start, @FWDSCAN) if finish == 0 break else filename = strsub(list, start, finish - start) if strlen(filename) == 0 then break start = finish + 1 ErrorMode(@OFF) owner = wntOwnerGet("", 0, filename, 300, 0) ErrorMode(@ON) if owner == "0" owner = "" endif if direxist(filename) filename = strcat(filename, "\") endif if strlen(filename) >= 20 filler = strcat("%@CRLF%", strfill("", 20)) else filename = StrFix(filename, "", 20) filler = "" endif outputline = strcat(filename, filler, owner) filewrite(tempfile, outputline) if finish == listlen then break endif endwhile fileclose(tempfile) run("notepad", tempfilename) filedelete(tempfilename)
Article ID: W14592
Filename: Get File Ownership in NT.txt
File Created: 2001:03:01:14:46:10
Last Updated: 2001:03:01:14:46:10