vbscript >> Getting File Info using GetDetailsOf

by scott » Mon, 07 Aug 2006 06:20:28 GMT

In CODE 2 I've got a working example from MS showing the properties of any
files that reside in c:\temp folder.

However, I'm failing miserably in CODE 1 Vbelow when simply trying to
display the date modified property of a single file. My MsgBox displays the
text "Date Modified" instead of the ctual datetime value of the property.
What am I doing wrong?

CODE 1 ***********

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\temp")
sFolderTargetDate = objFolder.GetDetailsOf("test.exe", 3)

MsgBox "date stamp: " & sFolderTargetDate


CODE 2 *****************

Dim arrHeaders(35)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\temp")
For i = 0 to 6
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next
For Each strFileName in objFolder.Items
For i = 0 to 6
MsgBox i & vbtab & arrHeaders(i) _
& ": " & objFolder.GetDetailsOf(strFileName, i)
Next
Next




vbscript >> Getting File Info using GetDetailsOf

by Steven Burn » Mon, 07 Aug 2006 07:45:11 GMT


Why not just use FSO?

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!



the

vbscript >> Getting File Info using GetDetailsOf

by Walter Zackery » Mon, 07 Aug 2006 15:17:31 GMT


: In CODE 2 I've got a working example from MS showing the properties of any
: files that reside in c:\temp folder.
:
: However, I'm failing miserably in CODE 1 Vbelow when simply trying to
: display the date modified property of a single file. My MsgBox displays
the
: text "Date Modified" instead of the ctual datetime value of the property.
: What am I doing wrong?
:
: CODE 1 ***********
:
: Set objShell = CreateObject("Shell.Application")
: Set objFolder = objShell.Namespace("C:\temp")
: sFolderTargetDate = objFolder.GetDetailsOf("test.exe", 3)
:
: MsgBox "date stamp: " & sFolderTargetDate
:


The GetDetailsOf method requires a FolderItem object, not a string, as its
first parameter.

sFolderTargetDate = objFolder.GetDetailsOf(objFolder.ParseName("test.exe"),
3)

vbscript >> Getting File Info using GetDetailsOf

by scott » Mon, 07 Aug 2006 21:06:06 GMT

FSO actions make Norton give virus warnings.

vbscript >> Getting File Info using GetDetailsOf

by OldDog » Tue, 08 Aug 2006 00:40:44 GMT

This pulls all the Access files in c:\scripts and gives you the first 9
details (Tab delimited);

Dim arrHeaders(35)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\Scripts")
WScript.Echo "Name" & vbTab & "Size" & vbTab & "Type" & vbTab & "Date
Modified" & vbTab & "Date Created" & vbTab & "Date Accessed" & vbTab &
"Attributes" & vbTab &_
vbTab & "Status" & vbTab & "Owner" & vbTab & "Author"

For Each strFileName in objFolder.Items
If objFolder.GetDetailsOf(strFileName, 2) = "Microsoft Office Access
Application" Then
WScript.Echo objFolder.GetDetailsOf(strFileName, 0) & _
vbTab & objFolder.GetDetailsOf(strFileName, 1) & _
vbTab & objFolder.GetDetailsOf(strFileName, 2) & _
vbTab & objFolder.GetDetailsOf(strFileName, 3) & _
vbTab & objFolder.GetDetailsOf(strFileName, 4) & _
vbTab & objFolder.GetDetailsOf(strFileName, 5) & _
vbTab & objFolder.GetDetailsOf(strFileName, 6) & _
vbTab & objFolder.GetDetailsOf(strFileName, 7) & _
vbTab & objFolder.GetDetailsOf(strFileName, 8) & _
vbTab & objFolder.GetDetailsOf(strFileName, 9)
End If
Next

Or, if you are feeling frisky, you can try PowerShell;

A specific File Type
get-childitem . *.mdb -rec -ea SilentlyContinue | select Name,
DirectoryName, Extension, LastWriteTime, LastAccessTime, CreationTime,
@{e={(Get-Acl $_.PSpath).Owner};n='Owner'} | export-csv
C:\Temp\FileType.csv

A specific Sub Directory
get-childitem P:\Agncrel\BackupOfDatabase -rec -ea SilentlyContinue |
select Name, DirectoryName, Extension, LastWriteTime, LastAccessTime,
CreationTime, Length, {(Get-Acl $_.PSpath).Owner} | export-csv
C:\Temp\SubDir.csv

Get-Content "C:\Scripts\foo.txt" | Get-ChildItem -ea SilentlyContinue |
Select-Object Name, DirectoryName, Extension, LastWriteTime,
LastAccessTime, CreationTime, Length, {(Get-Acl $_.PSpath).Owner} |
export-csv C:\Temp\Mtgsmnmi015.csv

A whole directory
Get-ChildItem . -Recurse -ea SilentlyContinue | Select-Object Name,
DirectoryName, Extension, LastWriteTime, LastAccessTime, CreationTime,
@{e={(get-acl $_.PSath).owner};n='Owner'} | export-csv
C:\Temp\WholeDir.csv

vbscript >> RE: Getting File Info using GetDetailsOf

by TWFscGg » Fri, 13 Oct 2006 05:10:02 GMT

This works (ASP)... retrieving all files from the images folder where this
script is run. Main thing is not to getdetails of a filename string, but of
an item within the object containing the namespace of the path.

rootpath = Server.MapPath("./")
path = Server.MapPath("images/")

dim fs, folder
Set objShell = CreateObject ("Shell.Application")
Set objFolder = objShell.Namespace(path)
Dim arrHeaders(39)
For i = 0 to 39
arrHeaders(i) = objFolder.GetDetailsOf (objFolder.Items, i)
Next
For Each strFileName in objFolder.Items
For i = 0 to 39
'If i <> 9 then
Response.Write(arrHeaders(i) & ": " & objFolder.GetDetailsOf
(strFileName, i) ) & "<br />" & vbCrLf
'End If
Next
Next
%>

Similar Threads

1. Getting image info using picturebox - VB.Net

2. getting info from text file

hi,
i have a text file that contains a few hundred rows of data.
i need to grap those words which starts with characters GG and which is
5 characters in length.

eg. GGXXX, GGC3F, etc

Can someone advise how can i achieve this?
thanks

3. Getting Info from a .TTF File - Visual Basic/VB

4. getting info from txt w/o using bookmarks?

Hi all,

I have a template to make a fax (or letter), when it is first ran it checks
for a txt
file using "System.PrivateProfileString", if it doesn't exist it shows a
userform requesting user information (name, phone nr. etc.) and then put
this information in the bookmarks in my
document and store it in a txt-file.
Now i also like to create a template i can use for a mail merge, and also
use this info (from the text file) in this document. But i allready found
that it is impossible to keep you bookmarks after a mail merge, they all get
deleted.
Is there a way to still get the info form the text file in my document
without using bookmarks? Is this possible with fields?

Thanks in advance,

Rhayan



5. Getting info from XML file VB.NET - Dreamweaver

6. putting info from one file into another using vba

I am using vba in spreadsheet1 to open and count data from an excel 
spreadsheet located online (spreadsheet2). Once that data is counted in 
spreadsheet2, I want that value to be printed in spreadsheet1 where the macro 
was initially run from. I have the following code so far, but it will 
(obviously) print the data in spreadsheet2 rather than spreadsheet1:

Sub openn()
Dim Countt As Long
Workbooks.Open Filename:="sample filename.xls"

Countt = CountColor(Range("D4:GE4"), 45, False) + 
CountColor(Range("D4:GE4"), 10, False) + CountColor(Range("d4:GE4"), 8, False)

Range("k53").Value = Countt

End Sub

How do I get it to put that value in spreadsheet1?

7. VS .NET 2003 vb PPC question - opening a database/getting version info - ADO.Net

8. Getting Image Compression Info in VB.NET

I have an existing TIFF file on disk.  I need to be able to read the image
compression information for this file using VB.NET.  I am trying to verify
that all files coming into my system are CCITT Group 3 or Group 4 TIFFs.  I
have found the methods to use to write Group3 and Group4 TIFFs, but I cannot
seem to read the compression type of an already existing TIFF.  Does anyone
know how to do this in VB.NET?  Thanks for the help.

Regards,

Corey Ellsworth