Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 10th, 2005, 03:04 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   Did you get an answer on how to loop to every file in every folder?

Thanks,

mmcdonal
 
Old March 10th, 2005, 03:16 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Michael
I don't think he did. I'd also be interested in that. I've never done it before.

Thanks,

Kevin

dartcoach
 
Old March 11th, 2005, 04:51 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

You can use the file system object to search through system folders
try this along with the GetWrdChars function.

Function InspectDocs(strPath As String, IncludeSubfolders As Boolean)

Set fso = CreateObject("Scripting.FileSystemObject")
Set fsFolder = fso.GetFolder(strPath)
Set fsSubFolders = fsFolder.SubFolders

Set fsFiles = fsFolder.Files

For Each File In fsFiles 'Get the files in this folder
    If Right(Trim(File.Name), 3) = "doc" Then 'Only check word files
        'Do something with the data
        MsgBox File.Path & " has " & GetWrdChars(File.Path) & " characters"
    End If
Next

If IncludeSubfolders Then 'Get the files in sub folders
    For Each Subfolder In fsSubFolders

        Set fsFolder = fso.GetFolder(Subfolder)
        Set fsFiles = fsFolder.Files

        For Each File In fsFiles 'Get the files in this folder
            If Right(Trim(File.Name), 3) = "doc" Then 'Only check word files
                'Do something with the data
                MsgBox File.Path & " has " & GetWrdChars(File.Path) & " characters"
            End If
        Next
    Next
End If

Set fso = Nothing
Set fsFolder = Nothing
Set fsSubFolder = Nothing
Set fsFile = Nothing

End Function

Jon





Similar Threads
Thread Thread Starter Forum Replies Last Post
replace equal charachter(=) in tag vsempoux XSLT 2 July 11th, 2008 03:38 AM
Error in Counting Jonas Access VBA 2 August 15th, 2006 12:21 AM
counting in XSL gezi XSLT 8 March 29th, 2006 06:50 PM
Chapter 10: Case Delete charachter sagh BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 August 1st, 2005 04:55 PM
Counting ?!? hcweb Classic ASP Basics 2 December 8th, 2003 05:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.