/**
* @author Supratim Samanta
* @since 13/01/2011 2025HRS
* @modified 14/01/2011 2348HRS
*
*/
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class FileTree {
private static List
private static int count = 0;
private static final String location = "./";
public static void main(String[] args) throws IOException {
File file = new File(location);
getFileTreeIterated(file);
printAll(fileArray);
}
private static void getFileTreeIterated(File file) {
if (file.isDirectory()) {
File[] fileList = file.listFiles();
try {
for (File tempFile : fileList) {
if (tempFile.isDirectory()) {
getFileTreeIterated(tempFile);
} else {
fileArray.add(tempFile);
count++;
}
}
} catch (NullPointerException npe) {
return;
}
} else {
fileArray.add(file);
count++;
}
}
private static void printAll(List
if (!(array.size() == 0)) {
Iterator
System.out.println("The Number Of Files : " + array.size());
while (it.hasNext()) {
File tempFile = it.next();
System.out.println(tempFile.getCanonicalPath());
}
} else
System.out.println("NOTHING FOUND");
}
}
Just change the "location" String attribute to your directory path. All files in that directory wiil be displayed. In my case the location is the current directory.
Cheers....
This is how my buddy Wesley Virgin's adventure starts with this SHOCKING and controversial video.
ReplyDeleteAs a matter of fact, Wesley was in the military-and soon after leaving-he discovered hidden, "self mind control" secrets that the government and others used to obtain everything they want.
These are the same SECRETS lots of famous people (notably those who "come out of nothing") and the greatest business people used to become rich and famous.
You probably know how you utilize only 10% of your brain.
That's mostly because the majority of your BRAINPOWER is UNCONSCIOUS.
Maybe this conversation has even occurred INSIDE your very own mind... as it did in my good friend Wesley Virgin's mind seven years back, while driving a non-registered, beat-up trash bucket of a car without a license and $3.20 in his pocket.
"I'm so fed up with living payroll to payroll! When will I get my big break?"
You've taken part in those types of questions, isn't it right?
Your very own success story is waiting to start. All you have to do is in YOURSELF.
WATCH WESLEY SPEAK NOW