On Mar 3, 12:37 am, Arne Vajh=F8j <a...@vajhoej.dk> wrote:
gaur.rit...@gmail.com wrote:
I am looking for a code to read sub directories that are created
randomly by "another program".i.e the name of the directories are not=
known in advance.
The File class has methods to find all subdirectories in a given direc=
Arne
YA! Thats True, but I also need to delete the contents inside them.
Sample Code .......
------------------------
File f1 = new File ( "C:\\Systems01") ;
File[] strFilesDirs = f1.listFiles ( );
for ( int i = 0 ; i < strFilesDirs.length ; i ++ ) {
if ( strFilesDirs[i].isDirectory ( ) )
System.out.println ( "Directory: " + strFilesDirs[i] ) ;
else if ( strFilesDirs[i].isFile ( ) )
System.out.println ( "File: " + strFilesDirs[i] + " (" +
strFilesDirs[i].length ( ) + ")" ) ;
-------------------------------------------------
This is what I am using, the problem is to delete the particular
content from a sub directory.
Such As:
Systems01
---Alpha
-----Kilo
-------Temp
I need to delete the contents of the Temp Directory!
Alpha is a random name, but the inside structure is going to be same
(Kilo>Temp)
("del" on windows or "rm -rf", "find ... | xargs rm" on Unixes).