Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - File search

Reply
 
Old 06-24-2008   #1 (permalink)
Tony WONG


 
 

File search

i wrote this vbscript to search office files in the PC hard drive.

but it returns more than 37xxx files result.

it only has 2 office files

anything i missed? file attributes?

i find the 1st variable (QWord) sum up itself many times.

thanks for your help.

tony

*********************************************
For Each Subfolder in Folder.SubFolders
if Subfolder.name <> "Windows" and Subfolder.name <> "Program Files"
and Subfolder.name <> "Default User" and Subfolder.name <> "RECYCLER" and
Subfolder.name <> "All Users" and Subfolder.name <> "Media Player" then
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
If right(objfile.name,3) = "doc" or right(objfile.name,4) = "docx"
Then
QWord = QWord + 1
ElseIf right(objfile.name,3) = "xls" or right(objfile.name,4) = "xlsx"
Then
QExcel = QExcel + 1
ElseIf right(objfile.name,3) = "mdb" or right(objfile.name,5) = "accdb"
Then
QAccess = QAccess + 1
End If
Next
Set colFiles = Nothing
end if
Next



My System SpecsSystem Spec
Old 06-24-2008   #2 (permalink)
Tony WONG


 
 

Re: File search

sorry it should be
i wrote this vbscript to "COUNT" office files in the PC hard drive.


"Tony WONG" <x34@xxxxxx> ¼¶¼g©ó¶l¥ó·s»D:%23TUmtVb1IHA.2292@xxxxxx
Quote:

>i wrote this vbscript to search office files in the PC hard drive.
>
> but it returns more than 37xxx files result.
>
> it only has 2 office files
>
> anything i missed? file attributes?
>
> i find the 1st variable (QWord) sum up itself many times.
>
> thanks for your help.
>
> tony
>
> *********************************************
> For Each Subfolder in Folder.SubFolders
> if Subfolder.name <> "Windows" and Subfolder.name <> "Program Files"
> and Subfolder.name <> "Default User" and Subfolder.name <> "RECYCLER" and
> Subfolder.name <> "All Users" and Subfolder.name <> "Media Player" then
> Set objFolder = objFSO.GetFolder(Subfolder.Path)
> Set colFiles = objFolder.Files
> For Each objFile in colFiles
> If right(objfile.name,3) = "doc" or right(objfile.name,4) = "docx"
> Then
> QWord = QWord + 1
> ElseIf right(objfile.name,3) = "xls" or right(objfile.name,4) = "xlsx"
> Then
> QExcel = QExcel + 1
> ElseIf right(objfile.name,3) = "mdb" or right(objfile.name,5) = "accdb"
> Then
> QAccess = QAccess + 1
> End If
> Next
> Set colFiles = Nothing
> end if
> Next
>

My System SpecsSystem Spec
Old 06-24-2008   #3 (permalink)
Tony WONG


 
 

Re: File search

ignore me. thx.

"Tony WONG" <x34@xxxxxx> ¼¶¼g©ó¶l¥ó·s»D:%235VnWZb1IHA.4040@xxxxxx
Quote:

> sorry it should be
> i wrote this vbscript to "COUNT" office files in the PC hard drive.
>
>
> "Tony WONG" <x34@xxxxxx> ¼¶¼g©ó¶l¥ó·s»D:%23TUmtVb1IHA.2292@xxxxxx
Quote:

>>i wrote this vbscript to search office files in the PC hard drive.
>>
>> but it returns more than 37xxx files result.
>>
>> it only has 2 office files
>>
>> anything i missed? file attributes?
>>
>> i find the 1st variable (QWord) sum up itself many times.
>>
>> thanks for your help.
>>
>> tony
>>
>> *********************************************
>> For Each Subfolder in Folder.SubFolders
>> if Subfolder.name <> "Windows" and Subfolder.name <> "Program Files"
>> and Subfolder.name <> "Default User" and Subfolder.name <> "RECYCLER" and
>> Subfolder.name <> "All Users" and Subfolder.name <> "Media Player" then
>> Set objFolder = objFSO.GetFolder(Subfolder.Path)
>> Set colFiles = objFolder.Files
>> For Each objFile in colFiles
>> If right(objfile.name,3) = "doc" or right(objfile.name,4) = "docx"
>> Then
>> QWord = QWord + 1
>> ElseIf right(objfile.name,3) = "xls" or right(objfile.name,4) = "xlsx"
>> Then
>> QExcel = QExcel + 1
>> ElseIf right(objfile.name,3) = "mdb" or right(objfile.name,5) = "accdb"
>> Then
>> QAccess = QAccess + 1
>> End If
>> Next
>> Set colFiles = Nothing
>> end if
>> Next
>>
>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Batch file to search file. .NET General
File search Vista file management
search- how to search with in a word file Vista General
Cannot search by file name Vista file management
search by file type....and other ways I could search in XP Vista file management


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46