This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I wanted to know how many files and directories are there in my x,y or z drive and if there is directory how many files and directories are there in this directory like this,
what I am able to get is the number of files and directories in x,y or z drive but not able to get "if there is directory how many files and directories are there in this directory"
I am using the below to code
first of all: use Code tags!I have no doubt you've heard of these, since this is your 24th post. Not only does that make a code listing much more readable, but it also gives a replier the chance to point to a specific line.
Make a method (must be static in your example) that takes a file as an argument, counts the number of files in that file, and for each file in that file that is a directory, do a recursion with that specific file as argument. You've written the code that goes into this method already.