Directory Listing using java.io.File
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anjali_N
Posted On:   Monday, June 10, 2002 02:49 AM

I need to get the Dir Info as follows: Given a directory, traverse them and to find the Size of each individual folders/subfolders in the directory tree, and its depth. Also in a suitable datastruct store the number of files in each dir, number of files by type etc. finally display all the info ie, size and depth of each dir, total number of files in each dir, number of files by type and the overall statistics (total number of files, total number of files by type, total size of the given directory and total number of sub dir etc... some explanation for depth,the starting directory has a depth 0, 1st level subdirectories have a depth of 1 etc. It will be of great help if u can provide me with code. Thanks in advance    More>>

I need to get the Dir Info as follows:

Given a directory, traverse them and to find the Size of each individual folders/subfolders in the directory tree, and its depth. Also in a suitable datastruct store the number of files in each dir, number of files by type etc. finally display all the info ie, size and depth of each dir, total number of files in each dir, number of files by type and the overall statistics (total number of files, total number of files by type, total size of the given directory and total number of sub dir etc...
some explanation for depth,the starting directory has a depth 0, 1st level subdirectories have a depth of 1 etc.

It will be of great help if u can provide me with code.

Thanks in advance

Regards
Anjali

   <<Less

Re: Directory Listing using java.io.File

Posted By:   Thomas_Hackel  
Posted On:   Monday, June 10, 2002 05:50 AM

just look into the API doc for java.io.File... there are some File.list*() methods.
the rest sounds like a computer science test/task or a school test/task. so solve this really easy recursive problem.
sorry first of all you have to understand programming basics before you take a programming language to solve your problems. go and read some of "knuth"'s algorithm-books or other basic lecture.
i hope no one provide you finished code here! this is a platform to exchange experience and knowledge, not for solving homework.
About | Sitemap | Contact