Dear All,
I need to know how many files there are in a particular folder. The following code works, but considering that, f.DateCreated, f.Size and f.Type, all provide the information I need. But f. FolderContents, f.Contents, and several others I tried do not work.
As I said this code works, but it is ugly. If anyone knows what I have to add to f. to provide me with the number of files in the folder, I shall be very grateful.
Regards,
john
I need to know how many files there are in a particular folder. The following code works, but considering that, f.DateCreated, f.Size and f.Type, all provide the information I need. But f. FolderContents, f.Contents, and several others I tried do not work.
Code:
Sub ShowFolderInfo(folderspec)
Dim fs, f, f1, fc, s, t, u, v
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
s = f.DateCreated
t = f.Size
u = f.Type
'v = f.FolderContents
x = 0
For Each f1 In fc
v = f1.Name
x = x + 1
Next
End Sub
As I said this code works, but it is ugly. If anyone knows what I have to add to f. to provide me with the number of files in the folder, I shall be very grateful.
Regards,
john