Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to find and count # of files in a directory
Hi I am trying to count the number of files in directory + subs, when I try I
get all files in the directory but not in the subs or I can get all thats in a sub but not sub and directory. Can anybody help please Charles |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to find and count # of files in a directory
Show the code you are using.
-- Regards, Tom Ogilvy "vqthomf" wrote: Hi I am trying to count the number of files in directory + subs, when I try I get all files in the directory but not in the subs or I can get all thats in a sub but not sub and directory. Can anybody help please Charles |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to find and count # of files in a directory
The code I am using is from "VBA Developer's Handbook which only have code
for Directory or subs there is not much in the help files I can get it to look into the directory and subs? Regards Charles "Tom Ogilvy" wrote: Show the code you are using. -- Regards, Tom Ogilvy "vqthomf" wrote: Hi I am trying to count the number of files in directory + subs, when I try I get all files in the directory but not in the subs or I can get all thats in a sub but not sub and directory. Can anybody help please Charles |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to find and count # of files in a directory
I think you can use something like this to get files from a folder and all
it's subfolders: Sub getFiles(strFolder As String) Set fso = CreateObject _ ("Scripting.FileSystemObject") If Not fso.FolderExists(strFolder) Then Debug.Print "The folder doesn't exist" Exit Sub End If Set folder = fso.GetFolder(strFolder) For Each file In folder.Files Debug.Print file.Path Next For Each subFolder In folder.Subfolders Call getFiles(subFolder.Path) Next End Sub If you need only the count of files you can ad a counter variable. -- urkec "vqthomf" wrote: The code I am using is from "VBA Developer's Handbook which only have code for Directory or subs there is not much in the help files I can get it to look into the directory and subs? Regards Charles "Tom Ogilvy" wrote: Show the code you are using. -- Regards, Tom Ogilvy "vqthomf" wrote: Hi I am trying to count the number of files in directory + subs, when I try I get all files in the directory but not in the subs or I can get all thats in a sub but not sub and directory. Can anybody help please Charles |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Choosing certain files in directory and one in particular | Excel Programming | |||
Files in a directory? | Excel Discussion (Misc queries) | |||
Check if directory empty OR no of files in directory. | Excel Programming | |||
find files and copy to new directory | Excel Programming | |||
Open files in directory | Excel Programming |