R raindrop3 Registered User. Local time Today, 19:12 Joined Sep 6, 2001 Messages 98 Nov 28, 2001 #1 Hi, I need to know how much files are in a dir. There may be no more than 150 in a dir. How do I count the files in a dir?? Short question, big trouble..... Thanks, Albert
Hi, I need to know how much files are in a dir. There may be no more than 150 in a dir. How do I count the files in a dir?? Short question, big trouble..... Thanks, Albert
PearlGI Registered User. Local time Today, 19:12 Joined Aug 30, 2001 Messages 125 Nov 28, 2001 #2 Hi, I use the following, which calls the Excel function FileSearch (ensure Microsoft Excel Object Library is referenced under Tools, References) With Application.FileSearch .Lookin = "c:\MyDir" .SearchSubFolders = False (or True depending) .Filename = "*.*" (or any file pattern you choose) .Execute myFileCount = .FoundFiles.Count End With HTH [This message has been edited by PearlGI (edited 11-28-2001).]
Hi, I use the following, which calls the Excel function FileSearch (ensure Microsoft Excel Object Library is referenced under Tools, References) With Application.FileSearch .Lookin = "c:\MyDir" .SearchSubFolders = False (or True depending) .Filename = "*.*" (or any file pattern you choose) .Execute myFileCount = .FoundFiles.Count End With HTH [This message has been edited by PearlGI (edited 11-28-2001).]
R raindrop3 Registered User. Local time Today, 19:12 Joined Sep 6, 2001 Messages 98 Nov 28, 2001 #3 Works great! Thanks. However, can I also count the number of (sub)directorys in a certain dir? Thanks. Albert
Works great! Thanks. However, can I also count the number of (sub)directorys in a certain dir? Thanks. Albert
simongallop Registered User. Local time Today, 19:12 Joined Oct 17, 2000 Messages 611 Nov 28, 2001 #4 Look at the DIR function in the help files. There is code there which can be easily amended to count instead of displaying names. HTH
Look at the DIR function in the help files. There is code there which can be easily amended to count instead of displaying names. HTH