This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Related to file count in xyz drive

 
upanshu vaid
Ranch Hand
Posts: 83
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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

 
upanshu vaid
Ranch Hand
Posts: 83
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just add to that I am using windows 7 in which // is used to give a pathname to a file or directory
 
Piet Souris
Rancher
Pie
Posts: 1211
25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi upanshu,

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.

Hope this helps.

Greetz,
Piet
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic