遍历

public static void QueLink(String path) {

		File file = new File(path);
		Queue<File> queue = new LinkedList<File>();
		queue.offer(file);
		while (!queue.isEmpty()) {
			File file2 = queue.poll();
			if (file2.isDirectory()) {

				File[] fs = file2.listFiles();
				for (int i = 0; i < fs.length; i++) {

					queue.offer(fs[i]);

				}
				System.out.println(file2.getName()+"---"+file2.getAbsoluteFile()+"***"+file2.getAbsolutePath());
				
				

			}
			else {
				//System.err.println(file2.getName());
			}

		}

	}

  

posted @ 2017-01-01 16:01  刀小爱  阅读(129)  评论(0)    收藏  举报