Shell脚本生成目录树结构文本文件 -- Snippets
2007-07-14 00:54
489 查看
不管出于什么目的, 本脚本的作用生成目录树状结构文本文件, 支持中文和有空格等的文件目录名. 比如
$./gdt.sh /cygdrive/e/ccccc -o
将/cygdrive/e/ccccc目录树状结构文本文件ccccc.txt. 如果不带目录名参数, 则生成当前目录树状结构.
本脚本完成使用Bash编程, 并且未使用sed, awk等.
具体用法和选项含意可使用-h显示简单帮助, 或见文章结尾源代码:
$./gdt.sh -h
用法说明如下:
usage: gdt.sh [-h] [-o [file name]] [-n] [directory]
Generate directory tree.
|-- for file, /-- for empty directory, +-- for non-empty directory.
Options:
-h help page, any other options ignored
-o output results to a file, no file name follwed means output file has a name same as directory.
-n no screen output, if no file specificed, it redirects to /dev/null
All extra arguments will be ignored automatically.
Only the first directory will be considered if more exist.
gdt源代码及生成文件样本
$./gdt.sh /cygdrive/e/ccccc -o
将/cygdrive/e/ccccc目录树状结构文本文件ccccc.txt. 如果不带目录名参数, 则生成当前目录树状结构.
本脚本完成使用Bash编程, 并且未使用sed, awk等.
具体用法和选项含意可使用-h显示简单帮助, 或见文章结尾源代码:
$./gdt.sh -h
用法说明如下:
usage: gdt.sh [-h] [-o [file name]] [-n] [directory]
Generate directory tree.
|-- for file, /-- for empty directory, +-- for non-empty directory.
Options:
-h help page, any other options ignored
-o output results to a file, no file name follwed means output file has a name same as directory.
-n no screen output, if no file specificed, it redirects to /dev/null
All extra arguments will be ignored automatically.
Only the first directory will be considered if more exist.
gdt源代码及生成文件样本
相关文章推荐
- 用Python编写生成树状结构的文件目录的脚本的教程
- centos shell脚本编程1 正则 shell脚本结构 read命令 date命令的用法 shell中的逻辑判断 if 判断文件、目录属性 shell数组简单用法 $( ) 和${ } 和$(( )) 与 sh -n sh -x sh -v 第三十五节课
- Linux系统目录结构,Shell脚本;关闭和开启防火墙
- BASH命令和SHELL脚本总结(19)递归地拷贝目录结构
- 一套自己写的生成三级不重复目录的SHELL脚本
- 用Python编写生成树状结构的文件目录的脚本的教程
- 如何用shell脚本删除目录结构为日期的目录(date)
- 显示目录结构的shell脚本
- 输出android目录结构的一个shell 脚本
- 生成树状结构的脚本bat\python\shell
- 生成树状结构的脚本bat\python\shell
- 用shell脚本生成文本文件
- Shell脚本实现获取网页快照并生成缩略图
- shell脚本仅列出当前目录下的文件及文件夹
- Shell脚本对比两个文本文件找出不同行的2个方法分享
- Shell脚本(脚本结构和执行方法,date命令用法,脚本中的变量)
- shell脚本中的逻辑判断 文件目录属性判断 if特殊用法 case判断
- 利用shell脚本生成qt 项目的项目文件列表
- shell脚本读写文本文件
- shell 脚本实现的遍历目录修改子目录及其文件权限