Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #12473

Getting File Info using GetDetailsOf with specific values

Newsgroups microsoft.public.scripting.vbscript
Date 2023-03-01 07:57 -0800
Message-ID <c4be98d4-6690-4b83-a4d0-1b77d26eb857n@googlegroups.com> (permalink)
Subject Getting File Info using GetDetailsOf with specific values
From Databeheer Quantore <quantoredatabeheer@gmail.com>

Show all headers | View raw


How can I define a value with 'Getting File Info using GetDetailsOf'

I'd like to list the files of a specific user.

Code is not mine, but the basics work for me. Is there anyone who can help me or point me in the right direction? Thanks!!!


Dim NewSht As Worksheet
    Dim MainFolderName As String
    Dim TimeLimit As Long, StartTime As Double
     
    ReDim X(1 To 65536, 1 To 11)
     
    Set objShell = CreateObject("Shell.Application")
    TimeLimit = Application.InputBox("Please enter the maximum time that you wish this code to run for in minutes" & vbNewLine & vbNewLine & _
    "Leave this at zero for unlimited runtime", "Time Check box", 0)
    StartTime = Timer
     
    Application.ScreenUpdating = False
    MainFolderName = BrowseForFolder()
    Set NewSht = ThisWorkbook.Sheets.Add
     
    X(1, 1) = "Path"
    X(1, 2) = "File Name"
    X(1, 3) = "Last Accessed"
    X(1, 4) = "Last Modified"
    X(1, 5) = "Created"
    X(1, 6) = "Type"
    X(1, 7) = "Size"
    X(1, 8) = "Owner"
    X(1, 9) = "Author"
    X(1, 10) = "Title"
    X(1, 11) = "Comments"
     
    i = 1
     
    Set FSO = CreateObject("scripting.FileSystemObject")
    Set oFolder = FSO.GetFolder(MainFolderName)
     'error handling to stop the obscure error that occurs at time when retrieving DateLastAccessed
    On Error Resume Next
    For Each Fil In oFolder.Files
        Set objFolder = objShell.Namespace(oFolder.Path)
        Set objFolderItem = objFolder.ParseName(Fil.Name)
        i = i + 1
        If i Mod 20 = 0 And TimeLimit <> 0 And Timer > (TimeLimit * 60 + StartTime) Then
            GoTo FastExit
        End If
        If i Mod 50 = 0 Then
            Application.StatusBar = "Processing File " & i
            DoEvents
        End If
        X(i, 1) = oFolder.Path
        X(i, 2) = Fil.Name
        X(i, 3) = Fil.DateLastAccessed
        X(i, 4) = Fil.DateLastModified
        X(i, 5) = Fil.DateCreated
        X(i, 6) = Fil.Type
        X(i, 7) = Fil.Size
        X(i, 8) = objFolder.GetDetailsOf(objFolderItem, 8)
        X(i, 9) = objFolder.GetDetailsOf(objFolderItem, 9)
        X(i, 10) = objFolder.GetDetailsOf(objFolderItem, 10)
        X(i, 11) = objFolder.GetDetailsOf(objFolderItem, 14)
    Next
     
     'Get subdirectories
    If TimeLimit = 0 Then
        Call RecursiveFolder(oFolder, 0)
    Else
        If Timer < (TimeLimit * 60 + StartTime) Then Call RecursiveFolder(oFolder, TimeLimit * 60 + StartTime)
    End If
     
FastExit:
    Range("A:K") = X
    If i < 65535 Then Range(Cells(i + 1, "A"), Cells(65536, "A")).EntireRow.Delete
    Range("A:K").WrapText = False
    Range("A:K").EntireColumn.AutoFit
    Range("1:1").Font.Bold = True
    Rows("2:2").Select
    ActiveWindow.FreezePanes = True
    Range("a1").Activate
     
    Set FSO = Nothing
    Set objShell = Nothing
    Set oFolder = Nothing
    Set objFolder = Nothing
    Set objFolderItem = Nothing
    Set Fil = Nothing
    Application.StatusBar = ""
    Application.ScreenUpdating = True
End Sub

Back to microsoft.public.scripting.vbscript | Previous | NextNext in thread | Find similar


Thread

Getting File Info using GetDetailsOf with specific  values Databeheer Quantore <quantoredatabeheer@gmail.com> - 2023-03-01 07:57 -0800
  Re: Getting File Info using GetDetailsOf with specific  values "Newyana2" <Newyana2@invalid.nospam> - 2023-03-01 22:16 -0500
    Re: Getting File Info using GetDetailsOf with specific values Databeheer Quantore <quantoredatabeheer@gmail.com> - 2023-03-08 05:01 -0800
      Re: Getting File Info using GetDetailsOf with specific values "Newyana2" <Newyana2@invalid.nospam> - 2023-03-08 08:59 -0500
        Re: Getting File Info using GetDetailsOf with specific values Databeheer Quantore <quantoredatabeheer@gmail.com> - 2023-03-08 07:23 -0800
          Re: Getting File Info using GetDetailsOf with specific values "Newyana2" <Newyana2@invalid.nospam> - 2023-03-08 13:39 -0500
  Re: Getting File Info using GetDetailsOf with specific values Ulrich Möller <um_moeller@arcor.de> - 2023-03-08 16:08 +0100
    Re: Getting File Info using GetDetailsOf with specific values Databeheer Quantore <quantoredatabeheer@gmail.com> - 2023-03-08 07:26 -0800

csiph-web