This piece of code might come in handy on a Windows platform to list the drives of a computer.
import java.io.File;
public class FileUtil {
public void listDrives() {
File[] drives = File.listRoots();
for (int i = 0; i < drives.length; i++) {
System.out.println(drives[i]);
}
}
public static void main(String[] args) {
FileUtil fileutil = new FileUtil();
fileutil.listDrives();
}
}
Wednesday, May 27, 2009
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment