General discussion

Locked

There must be an easy way - File Listing

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.

This conversation is currently closed to new comments.

8 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

There must be an easy way - File Listing

by Joseph Moore In reply to There must be an easy way ...

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

Collapse -

There must be an easy way - File Listing

by dgabbard In reply to There must be an easy way ...

That is what I did also.

Collapse -

There must be an easy way - File Listing

by Bughunter In reply to There must be an easy way ...

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.

Collapse -

There must be an easy way - File Listing

by dgabbard In reply to There must be an easy way ...

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

Collapse -

There must be an easy way - File Listing

by Chris.Lewis In reply to There must be an easy way ...

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="<UNK>"
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

Collapse -

There must be an easy way - File Listing

by Chris.Lewis In reply to There must be an easy way ...

&&^%&^# 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

Collapse -

There must be an easy way - File Listing

by dgabbard In reply to There must be an easy way ...

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

Collapse -

There must be an easy way - File Listing

by dgabbard In reply to There must be an easy way ...

This question was closed by the author

Back to Windows Forum
8 total posts (Page 1 of 1)  

Related Discussions

Related Forums