Hi,
i was wondering if someone could help me. i want to be able to print some properties of a file i.e. the date it was created and accessed. can anyone help me. i have tried looking for the methods but can't find them.
thanks in advanced
scoobie
here is the code i'm using. this code returns a list of files and their sizes in a particular directory:
Code:
DirectoryDialog dialog = new DirectoryDialog(shell);
dialog.setText("Browse For Folder");
dialog.setFilterPath("c:\\"); // Windows specific
File dir = new File("directoryName");
File files[] = dir.listFiles();
String res = dialog.open();
File path = new File(res);
files = path.listFiles();
System.out.println("PATH is: " + path + "\n\n");
int i;
int count = 1;
for(i = 0; i < files.length; i++)
{
File filename = files[i];
long size = filename.length()/1000;
//Date modify = files[i].lastModified();
System.out.println(count + " Filename: " + filename + "\n" + "Size: " + size + " KB\n" + "Path: " + path + "\n\n");
}
i++;