General discussion

  • Creator
    Topic
  • #2329264

    There must be an easy way – File Listing

    Locked

    by dgabbard ·

    How in Windows 2000 can I find all database files (*.mdb) and send the results to a text file. The DIR command is not a clean output. I want a listing of path, file name, date, and owner.

    Novell had a utility that did the trick, but I am working on a Windows 2000 network.

All Comments

  • Author
    Replies
    • #3487152

      There must be an easy way – File Listing

      by joseph moore ·

      In reply to There must be an easy way – File Listing

      I can’t get it exactly the way you are looking for. There is a /B switch for DIR which suppressed everything EXCEPT the path and file name, but it is turning off too much.

      The best I can find is to use the following:
      dir *.mdb /n /s /q /a-d >c:\yourfile.txt

      An example of what all of those switches would give you is below:

      C:\temp>dir *.txt /n /s /q /a-d
      Volume in drive C has no label.
      Volume Serial Number is 3C4C-146F

      Directory of C:\temp\dir1

      09/27/2002 01:37p 18 BUILTIN\Administrators test4.txt
      1 File(s) 18 bytes

      Directory of C:\temp\helpme

      09/30/2002 12:08p 1,820 BUILTIN\Administrators iis.txt
      1 File(s) 1,820 bytes

      Total Files Listed:
      2 File(s) 1,838 bytes
      0 Dir(s) 8,421,646,336 bytes free

      So, there is the summary file info that I can’t get rid of, but it does have path, file, date and owner.

      hope this helps

    • #3487148

      There must be an easy way – File Listing

      by bughunter ·

      In reply to There must be an easy way – File Listing

      Try this link

      http://www.gavlockconsulting.com/smartdir.htm

      This app costs $20 but it seems to do just about anything you might want in regards to file lists.

      • #3488865

        There must be an easy way – File Listing

        by dgabbard ·

        In reply to There must be an easy way – File Listing

        Excellent tool…This is exactly what I was looking for. Plus it has more that I sure that I will use later.

    • #3487089

      There must be an easy way – File Listing

      by chris.lewis ·

      In reply to There must be an easy way – File Listing

      Here’s a vbscript to do what you need:
      option explicit
      CONST PRN_FLD=False

      Dim oF
      Dim rWMI
      Dim regEx

      Set oF=CreateObject(“Scripting.FileSystemObject”)
      set rWMI=GetObject(“winMgmts:”)
      If Err <> 0 Then
      WScript.Echo “NO WMI..” & Err.Description
      WScript.Quit
      End If
      Set regEx=New RegExp

      Call Main
      Set oF =Nothing
      set rWMI=Nothing

      Sub Main ()
      Dim sFold
      Dim sType
      Dim sA
      Dim sMch

      If WScript.Arguments.Count=0 Then
      sFold=oF.GetAbsolutePathName(“.”)
      Else
      sA=WScript.Arguments(0)
      If InStr(sA, “*”) > 0 Or InStr(sA, “?”) > 0 Then
      sMch=FixRX(StrReverse(Left(StrReverse(sA), InStr(StrReverse(sA), “\”) – 1)))
      sFold=oF.GetParentFolderName(WScript.Arguments(0))
      Else
      sFold=oF.GetAbsolutePathName(sA) sMch=FixRX(“*.*”)
      End if
      End If

      regEx.Pattern=sMch
      regEx.IgnoreCase=True

      Call ShowFiles (sFold)
      End Sub

      Function ShowFiles(sCurFld)
      Dim oFld
      Dim csFlds
      Dim oSFld
      Dim cFls
      Dim oFl
      Set oFld=oF.GetFolder(sCurFld)
      Set csFlds=oFld.SubFolders
      Set cFls=oFld.Files
      For Each oFl In cFls
      If regEx.Test(oFl.Name) Then
      wscript.echo oFl.Path & vbTab & oFl.Size & vbTab & oFl.DateLastModified & VBTab & FlOwn(oFl.Path )
      End If
      Next

      For Each oSFld In csFlds
      If PRN_FLD Then
      wscript.echo oSFld.Path
      End If
      ShowFiles oSFld.Path
      Next
      End Function

      Function FlOwn(sFl)
      Dim sQ
      Dim cOwn
      Dim rI

      sQ=”ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='” & sFl & “‘} WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner”
      set cOwn=rWMI.ExecQuery(sQ)

      For Each rI In cOwn
      If Err=0 Then
      FlOwn=rI.AccountName
      Else
      FlOwn=”
      End If
      Next
      Set cOwn=Nothing
      End function

      Function FixRX(strDOS)
      Dim sT
      sT=strDOS
      sT=Replace(sT,”.”,”\.”)
      sT=Replace(sT,”?”,”.”)
      strTemp=Replace(sT,”*”,”.?”)
      FixRX=sT
      End Function

      • #3487088

        There must be an easy way – File Listing

        by chris.lewis ·

        In reply to There must be an easy way – File Listing

        &&^%&^# stupid character limit…

        last function s/b this:

        Function FixRX(strDOS)
        Dim sT
        sT=strDOS
        sT=Replace(sT,”.”,”\.”)
        sT=Replace(sT,”?”,”.”)
        sT=Replace(sT,”*”,”.?”)
        FixRX=sT
        End Function

      • #3488866

        There must be an easy way – File Listing

        by dgabbard ·

        In reply to There must be an easy way – File Listing

        You are over my head on this one. I have done some prgramming pre Windows 3.1…I am sure what you did would work, but I like the utility I found in the link above.

        Thanks

    • #3488863

      There must be an easy way – File Listing

      by dgabbard ·

      In reply to There must be an easy way – File Listing

      This question was closed by the author

Viewing 3 reply threads