?????г??????μ???????????
????public class FileDemo3 {
????public static void main(String[] args){
????File[] files =File.listRoots();
????for(File file:files){
????System.out.println(file);
????if(file.length()>0){
????String[] filenames =file.list();
????for(String filename:filenames){
????System.out.println(filename);
????}
????}
????}
????}
????}
???????????
import java.io.File;
import java.io.FilenameFilter;
public class FileDemo4 {
public static void main(String[] args){
File[] files =File.listRoots();
for(File file:files){
System.out.println(file);
if(file.length()>0){
String[] filenames =file.list(new FilenameFilter(){
//file ?????? name ?????
public boolean accept(File file??String filename){
return filename.endsWith(".mp3");
}
});
for(String filename:filenames){
System.out.println(filename);
}
}
}
}
}
File[]  listFiles()
File[] listFiles(FilenameFilter filter)
???????????г???????
public class FileDemo5 {
public static void main(String[] args){
File f =new File("e:\???");
showDir(f);
}
public static void showDir(File dir){
System.out.println(dir);
File[] files =dir.listFiles();
for(File file:files){
if(file.isDirectory())
showDir(file);
else
System.out.println(file);
}
}
}
??????????
???????d???????е? .java ??????????? c:jad ???£????????????????????.java ????.jad ??
public class Test5 {
public static void main(String[] args){
File f1 = new File("d:\");
moveFile(f1);
}
public static void moveFile(File dir){
File[] files=dir.listFiles();
for(File file:files){
if(file.isDirectory())
moveFile(file);
else{
if(file.getName().endsWith(".java"))
file.renameTo(new File("c:\jad\"+
file.getName().substring(0??file.getName().lastIndexOf('.'))+".jad"));
}
}
}
}
??????????Java File??????????????????????????????????????????????????????????????????????????????