Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

count the number of files in a directory

Status
Not open for further replies.

abyinsydney

Programmer
Feb 17, 2004
99
0
0
AU
greetings fellow ctizens

could any one of you let me know how to count the number of text files in the directory.

suppose i have a directory named aby and there are 5 text files how do i count them and store them in an array.


regards
aby

 
Aby, you really should start to read the documentation before posting simple questions.


If you had read this, then you would see that the below method lists the files in a directory and returns the results in an array :

File[] files = new File("mydir").listFiles();

--------------------------------------------------
Free Database Connection Pooling Software
 
sedj
sorry buds for being a womb bat will taske your advice in to consideration

aby
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top