+ Post New Thread
Results 1 to 6 of 6
Windows Thread, List files by owner in Technical; Has anyone found a way (scripting/VB etc) to produce a list of files for a particular owner (i.e the NTFS ...
  1. #1
    Sheridan's Avatar
    Join Date
    Oct 2010
    Posts
    1,437
    Thank Post
    130
    Thanked 109 Times in 73 Posts
    Rep Power
    33

    List files by owner

    Has anyone found a way (scripting/VB etc) to produce a list of files for a particular owner (i.e the NTFS owner)

    I'd like to do some maintenance and this would be really handy but I havne't found a way in Vb6 (yet!)

  2. #2
    cromertech's Avatar
    Join Date
    Dec 2007
    Location
    Cromer by the coast
    Posts
    731
    Thank Post
    177
    Thanked 109 Times in 97 Posts
    Rep Power
    55
    I found one on this site VBScript : Find Files By Owner

    Code:
    Set objShell = CreateObject ("Shell.Application")
    Set objStartFolder = objShell.Namespace ("N:\")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    strUsername = "DOMAIN\User"
    oFolder = "N:\"
    
    Dim arrHeaders(13)
    
    ShowSubfolders objFSO.GetFolder(oFolder)
    
    Sub ShowSubFolders(Folder)
    On Error Resume Next
        For Each Subfolder in Folder.SubFolders
            Set oNsp = objShell.Namespace(Subfolder.Path)
            'Dim arrHeaders(13)
            For i = 0 to 13
                arrHeaders(i) = oNsp.GetDetailsOf (oNsp.Items, i)
            Next
    
            For Each strFileName in oNsp.Items
                If LCASE(oNsp.GetDetailsOf (strFileName, 8)) = LCASE(strUsername) Then
            
                Wscript.Echo Subfolder.Path & "\" & strFilename & "," & arrHeaders(1) & "," & Replace(oNsp.GetDetailsOf (strFileName, 1),",","") 
                End If
            Next
        ShowSubFolders Subfolder
        Next
    End Sub
    As the site says you can pipe the results to a file and maybe get it ask for the username you want or parse the users from active directory

  3. Thanks to cromertech from:

    Sheridan (12th May 2011)

  4. #3
    Sheridan's Avatar
    Join Date
    Oct 2010
    Posts
    1,437
    Thank Post
    130
    Thanked 109 Times in 73 Posts
    Rep Power
    33
    Thats looks like just what I'm after - thanks!

    (I didn't even see that site in my google searches )

  5. #4
    Sheridan's Avatar
    Join Date
    Oct 2010
    Posts
    1,437
    Thank Post
    130
    Thanked 109 Times in 73 Posts
    Rep Power
    33
    Hmm I don't seem to be able to get this working - when I run and check whats being picked up as the owner, it always shows it as 'not available'

    EDIT - Seems to be when running Windows 7 - ran it on Server 2003 and now getting the results I was expecting! job done!
    Last edited by Sheridan; 12th May 2011 at 04:37 PM.

  6. #5

    Join Date
    Mar 2011
    Location
    Bournemouth
    Posts
    280
    Thank Post
    16
    Thanked 74 Times in 64 Posts
    Rep Power
    22
    If you have windows 7 or server 2008 r2 you can add owner as a column to the normal explorer view and use it to sort. Easy Just rick click on the headers in detail view and click more, select owner and click ok. You can then click the owner header to sort.

  7. Thanks to ChrisMiles from:

    Sheridan (13th May 2011)

  8. #6
    Sheridan's Avatar
    Join Date
    Oct 2010
    Posts
    1,437
    Thank Post
    130
    Thanked 109 Times in 73 Posts
    Rep Power
    33
    The Win7 view is useful - but I needed to extract it so I could put it into a spreadsheet and sort/find items.

    Got the script working on Win7 now as well - I must have made a typo or something originally.



SHARE:
+ Post New Thread

Similar Threads

  1. file owner
    By trixter2004 in forum Netware
    Replies: 3
    Last Post: 7th February 2011, 11:22 AM
  2. ProFTPD owner of files
    By Mintsoft in forum *nix
    Replies: 13
    Last Post: 1st November 2010, 02:17 PM
  3. Offline task owner
    By imiddleton25 in forum Office Software
    Replies: 0
    Last Post: 25th August 2010, 01:06 PM
  4. Fronter - Owner/Delete
    By bikeman17 in forum Virtual Learning Platforms
    Replies: 9
    Last Post: 22nd April 2010, 01:10 PM
  5. list and print files
    By alonebfg in forum Windows
    Replies: 4
    Last Post: 28th June 2009, 04:57 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •