打印所有文件路径
2011-05-17 01:37
239 查看
import java.io.File; public class TestAllFile{ // 打印指定目录下的所有文件路径和文件名 public static void f(String dir){ try{ File f = new File(dir); String[] fileList = null; if(f.isDirectory()){ fileList = f.list(); for(int i=0; i<fileList.length; i++){ f(dir + "//" + fileList[i]); } }else{ System.out.println(dir); } }catch(Exception e){ } } public static void main (String[] args) { String s = "E:"; f(s); } }
相关文章推荐
- python3中分别用递归,栈,和队列打印出目录中所有文件的绝对路径的三种方法
- 如何利用闭包递归打印出当前路径下所有文件
- 从键盘接收一个文件夹路径,把文件夹中的所有文件以及文件夹的名字按层级打印
- 在当前目录以及当前目录的所有子目录下查找文件名包含指定字符串的文件,并打印出相对路径
- 利用递归算法遍历所有文件并打印文件绝对路径(包括文件夹)
- 编写一个Python程序,能在当前目录以及当前目录的所有子目录下查找文件名包含指定字符串的文件,并打印出相对路径
- 列出某一路径下所有的文件及文件夹,并打印出来,同一目录下,文件合并刷选出来
- python 文件和目录 当前目录以及当前目录的所有子目录下查找文件名包含指定字符串的文件,并打印出相对路径。
- 查找目录下的及子目录下的 所有的给定后缀名的文件并将其路径打印到一个文件中。
- Python:打印某个路径下的所有文件
- 【代码】当前目录以及当前目录的所有子目录下查找文件名包含指定字符串的文件,并打印出绝对路径
- 编写文件搜索小程序:1. 输入绝对路径以及搜索关键字,2. 搜索指定路径下(包括子文件夹)中名称包含关键字的所有文件并打印出,3. 将当前操作记录日志
- 编写一个程序,能在当前目录以及当前目录的所有子目录下查找文件名包含指定字符串的文件,并打印出相对路径。
- 从键盘输入接收一个文件夹路径,打印出该文件夹下所有的.txt文件名(后缀名文件)
- 【理解】一个利用递归打印对象路径下所有文件的小程序
- 打印一个文件路径下的所有文件及信息
- 详解shell 遍历文件夹内所有文件并打印绝对路径
- 输入一个整数和一棵二元树。从树的根结点开始往下访问一直到叶结点所经过的所有结点形成一条路径。打印出和与输入整数相等的所有路径。
- PHP循环输出指定目录下的所有文件和文件夹路径例子(简单实用)
- 遍历并打印指定目录下所有文件