Help with getting the sum of files in a directory

I am trying to find the the size of some files in a directory. Then i want to get the sum of those. I have it set up to list all of the files but it returns a value of 0 for all the files. Once i can return the correct sizes i should have not problem adding them. Does someone see where my error is in my code?

import java.io.*;

publicclass DirectorySize{

publicstaticvoid main(String args[])throws IOException{

File file1 =new File("C://Documents and Settings/Tedd/My Documents/School/CST 200/");

System.out.println("File Name:" + file1.getName());

System.out.println("Path:" + file1.getPath());

System.out.println("Abs Path:" + file1.getAbsolutePath());

System.out.println("is a directory" + file1.isDirectory() );

System.out.println("File size:" + file1.length() +" Bytes");

String[] dirListing = file1.list();

for (int i = 0; i < dirListing.length; i++){

System.out.println(dirListing[i]);

System.out.println("File size:" + file1.length() +" Bytes");

}

}}

[1792 byte] By [rexdarta] at [2007-11-26 22:51:44]
# 1
> "C://Documents and Settings/Tedd/My Documents/School/CST 200/1) That's a directory, not a file. So its "length" is meaningless.2) What's up with 2 slashes after the drive?
warnerjaa at 2007-7-10 12:13:56 > top of Java-index,Java Essentials,New To Java...
# 2
That is what i am trying to do. Get the size of a directory. I don't know what is up with the slashes. It was the only way i was able to get it to read the directory.If 'length' not how you find the size of the directory then what is? why would it work for files but not
rexdarta at 2007-7-10 12:13:56 > top of Java-index,Java Essentials,New To Java...
# 3

Straight from the JavaDocs:

public long length()

Returns the length of the file denoted by this abstract pathname. The return value is unspecified if this pathname denotes a directory.

Returns:

The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist

Please read the docs before jumping to conclusions about what a method does or does not do.

http://java.sun.com/j2se/1.5.0/docs/api/index.html

warnerjaa at 2007-7-10 12:13:56 > top of Java-index,Java Essentials,New To Java...