http://www.csdn.net/Develop/Read_Article.asp?Id=18902

解决方案 »

  1.   

    不知道你是不是这个意思,扫描文件夹里的文件
    假如要扫描子目录,去掉注释就行了
    public class FindCheckFile
    {
        public static void main(String[] args)
        {
            if(args.length==0) args=new String[]{"c:\\"};
            try
            {
                File pathName=new File(args[0]);
                String[] fileNames=pathName.list();         
                //enumerate all files in the directory
                for (int i=0;i<fileNames.length;i++)
                {
                    File f=new File(pathName.getPath(),fileNames[i]);
                    System.out.println(f.getCanonicalPath());
                    //if the file is again directory,call the main method recursively
                    //if(f.isDirectory())
                    //{
                    //   main(new String[]{f.getPath()});
                    //}
                }
            }
            catch(IOException e)
            {
                e.printStackTrace();
            }
        }
    }
                
      

  2.   

    yangFrame(yangFrame) 已经实现了。
      

  3.   

    用递归
    import java.io.*;
    class A
    {
    public static void main(String[] args)
    {
    File file=new File("e:\\1000");
        A a=new A();
    a.read(file); }
    public void read(File f)
    {
    File[] files=f.listFiles();
    for(int i=0;i<files.length;i++)
    {
    File tmpFile=files[i]; if(tmpFile.isDirectory())
    this.read(tmpFile);
    else
    System.out.println("file:"+tmpFile);
    }
    }}