打印指定路径的目录树 Print the directory tree for the specified path
use FileTreePrinter.class
print:
$ java C:\Program Files\Internet Explorer
create file:
$ java C:\Program Files\Internet Explorer .\tree.txt
public static void main(String[] args) {
if (args.length > 0) {
FileTreePrinter printer = new FileTreePrinter(args[0]);
if (args.length > 1) {
printer.createFileTreeFile(args[1]);
} else {
printer.printFileTree();
}
}
}
result:
+--- en-US
| \--- hmmapi.dll.mui
+--- images
| \--- bing.ico
+--- SIGNUP
| \--- install.ins
+--- zh-CN
| +--- ieinstal.exe.mui
| \--- iexplore.exe.mui
+--- ExtExport.exe
+--- hmmapi.dll
+--- iediagcmd.exe
+--- ieinstal.exe
+--- ielowutil.exe
+--- IEShims.dll
\--- iexplore.exe