Re: Dumb question of the day

On Jun 9, 11:01 am, "LJB" <postmaster@[]> wrote:
"billious" <billious_1...@xxxxxxxxxxx> wrote in message


"Dan Payne" <grumpyo...@xxxxxxxxx> wrote in message
I have no experience with VB scripting, so of course I was asked to
write one....
Here's the question.
Is there any VB code out there that is available for public use that
would scan directories, and return information such as full path,
extension, owner, file size, etc out there that I could use???  I signed
up for a class on VBscripting, but they have postponed it twice so far
this year, and my deadline is coming up soon.  This is probably the
easiest thing to do, and if it was C or Pascal (showing my age) it would
be easy, but we don't have those compilers available at work....

Thanks for any help, and not laughing too hard...  ;-)

When you come to a fork in the road, take it. - Yogi Berra

*** Sent via Developersdex***

Try alt.msdos.batch.nt.

No doubt with a proper requirements specification a solution could be
easily constructed using DIR and CACLS and a few processing tricks.

I think I got this from
Sorry I can't verify that today. Just change the path you want to scan.

Dim arrHeaders(35)

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.NameSpace("C:\scratch")

For i = 0 To 34
   arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)

For Each strFileName In objFolder.Items
   For i = 0 To 34
      Wscript.Echo i & vbTab & arrHeaders(i) & ": " &
objFolder.GetDetailsOf(strFileName, i)
Next- Hide quoted text -

- Show quoted text -

Not to be a smart ass, but you can do this in PowerShell like this:

#<--- Start Script --------->
$a = Get-Date -format g
$row = 2
$xl = New-Object -c excel.application
$xl.visible = $True
$wb = $xl.workbooks.add()
$sh = $wb.sheets.item(1)
$sh.Range("A1:T1").Font.Bold = $true
$sh.Range("A:A").Font.Bold = $True
$sh.Cells.Item(1, 1) = "Computer Name"
$sh.Cells.Item(1, 2) = "Date Run" + $a
$sh.Cells.Item(1, 3) = "FullName"
$sh.Cells.Item(1, 4) = "Length"
$sh.Cells.Item(1, 5) = "Owner"
$sh.Cells.Item(1, 6) = "Extension"
$sh.Cells.Item(1, 7) = "LastAccessTime"
$sh.Cells.Item(1, 8) = "CreationTime"
$sh.Cells.Item(1, 9) = "Group Access"

# you will need a list of computers, one computer name per line
$computerlist = Get-Content 'c:\scripts\Servers.txt'
foreach ($srv in $computerlist)
$sh.Cells.Item($row, 1) = $srv
$response = Get-WmiObject -query "Select * From Win32_PingStatus Where
Address = '$srv'"

if( ($response -eq $null) -or ($response.StatusCode -ne 0)) {
$sh.Cells.Item($row, 2).Font.ColorIndex = 3
$sh.Cells.Item($row, 2) = "Does Not Ping"
} else { if ($response.TimeToLive -le 64)
$sh.Cells.Item($row, 2).Font.ColorIndex = 5
$sh.Cells.Item($row, 2) = "probably is a Unix host"
} Else {
# Change the path and the extension. If you want all files,
remove the -include *.???
Get-ChildItem -path c:\scripts\ps1 -recurse -include *.ps1 -ea
continue |
foreach {
$file = New-Object -TypeName
Add-Member -InputObject $file -MemberType NoteProperty -Name
"FullName" -Value $_.Fullname
Add-Member -InputObject $file -MemberType NoteProperty -Name
"LastAccessTime" -Value $_.LastAccessTime
Add-Member -InputObject $file -MemberType NoteProperty -Name
"LastWriteTime" -Value $_.LastWriteTime
$acl = Get-Acl -Path $_.FullName
Add-Member -InputObject $file -MemberType NoteProperty -Name
"Owner" -Value $acl.Owner
Add-Member -InputObject $file -MemberType NoteProperty -Name
"AccessToString" -Value
Add-Member -InputObject $file -MemberType NoteProperty -Name
"Group" -Value $acl.Group
$sh.Cells.Item($row, 3) = $_.FullName
$sh.Cells.Item($row, 4) = $_.Length
$sh.Cells.Item($row, 5) = $acl.Owner
$sh.Cells.Item($row, 6) = $_.Extension
$sh.Cells.Item($row, 7) = $_.LastAccessTime
$sh.Cells.Item($row, 8) = $_.CreationTime
$sh.Cells.Item($row, 9) = $acl.Group

$row++ }


# close and release resources
spps -n excel

#---- End Script -------------->