linux下实现类似DOS中的tree列目录列文件命令

在/usr/local/bin中新建一tree文件,将以下代码拷入:
filez=`echo $1 | sed -e 's/-d/-type d/g' -e 's/-f//g'`

find $filez -print | sort -f |
sed -e "s,^${1-.},," /
-e "/^$/d" /
-e "s,[^/]*//([^/]*/)$,/`-----/1," /
-e "s,[^/]*/,| ,g"

然后:
chmod 0755 tree
tree /mnt/cd1 | more   (一页页查看)
tree /mnt/cd1 > cd1.txt   (保存到文件中)

你可能感兴趣的:(linux下实现类似DOS中的tree列目录列文件命令)