By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,582 Members | 1,720 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,582 IT Pros & Developers. It's quick & easy.

How to check if a directory is empty?

P: n/a
Is there a quick way to determine if a directory is empty.
Directory.Getfiles() doesn't tell me how many files without having to loop
thru the list.

Thanks

Bill
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
directory.getfiles().count ?

"Bill nguyen" <bi*****************@jaco.com> wrote in message
news:e6**************@TK2MSFTNGP14.phx.gbl...
Is there a quick way to determine if a directory is empty.
Directory.Getfiles() doesn't tell me how many files without having to loop
thru the list.

Thanks

Bill

Nov 21 '05 #2

P: n/a
"Bill nguyen" <bi*****************@jaco.com> schrieb:
Is there a quick way to determine if a directory is empty.
Directory.Getfiles() doesn't tell me how many files without having to loop
thru the list.


\\\
Dim FileCount As Integer = Directory.GetFiles("C:\Foo").Length
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
I'll try .Length . I couldn't find .Count with Getfiles()

Thanks both Brian & Herfried for your prompt response.

Bill
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ek**************@TK2MSFTNGP14.phx.gbl...
"Bill nguyen" <bi*****************@jaco.com> schrieb:
Is there a quick way to determine if a directory is empty.
Directory.Getfiles() doesn't tell me how many files without having to
loop thru the list.


\\\
Dim FileCount As Integer = Directory.GetFiles("C:\Foo").Length
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.