文件夹树权利 [英] Folders tree with rights
问题描述
在OS X和SunOS操作系统没有存在'的bash命令树。
要画出我用下面的指令文件夹树图:
找到。 ð型-print | SED -e的; [^ /] * /; | ____;克; S; ____ |; |; G'
或者,这显示的文件了。
找到。 -print | SED -e的; [^ /] * /; | ____;克; S; ____ |; |; G'
但我需要其中还包含文件夹权限的另一个版本。林pretty失去了右侧添加的文件夹权限。任何人有任何想法??
更新:
有任何选项绘制文件夹内的文件和自己的权利了。我试图用这个命令找到。 -print | SED -e的; [^ /] * /; | ____;克; S; ____ |; |克
和操作的组合与由#fedorqui提供的解决方案,但结果并非如此好
这与上面的命令获得的,没有权利的结果。
| | | ____ SRC
| | | | ____ cft2exit.c
| | | | ____ cft2exit_AIX
| | | | ____ cft2exit_SUN
| | | | ____ gestidt.c
| | | | ____ gestidt.h
| | | | ____ gestidt.o
| | | | ____ gestidt_AIX
| | | | ____ gestidt_SUN
| | | | ____ gestidt_SunOS
| | | | ____的makefile
| | | | ____ sem.a
| | | | ____ ut_sem.c
| | | | ____ ut_sem.h
| | | | ____ ut_sem.o
| | ____数据
| | | ____ purge.dat
| | ____的lost + found
您可以执行 LS -ld
为的每个结果发现
。它会给你的权限,其他的事情,然后将该文件名。如果你再管awk中,用的awk'{$打印NF,$ 1}
则可以打印信息的两个块。最后,你管你的 SED
命令。一起:
找到。 ð型LS -exec -ld {} \\; | AWK'{$打印NF,$ 1}'| SED -e的; [^ /] * /; | ____;克; S; ____ |; |; G'
测试
$找到。 ð型LS -exec -ld {} \\; | AWK'{$打印NF,$ 1}'| SED -e的; [^ /] * /; | ____;克; S; ____ |; |; G'
。 drwxrwxr-X
| ____蟒蛇drwxrwxr-X
| | ____的Jinja2 drwxrwxr-X
| | | ____ BK drwxrwxr-X
| | | ____ infiles drwxrwxr-X
.......
在小步骤:
$找到。 ð型LS -exec -ld {} \\;
drwxrwxr-x 7的我我4096年08月15 15:35。
drwxrwxr-X 3我我4096年08月13 14:31 ./python
drwxrwxr-X 4我我4096年04月26 15:14 ./python/jinja2
drwxrwxr-X 2我我4096年04月19 14:26 ./python/jinja2/bk
drwxrwxr-X 2我我4096 4月19日12点54分./python/jinja2/infiles
然后
$找到。 ð型LS -exec -ld {} \\; | AWK'{$打印NF,$ 1}
。 drwxrwxr-X
./python drwxrwxr-X
./python/jinja2 drwxrwxr-X
./python/jinja2/bk drwxrwxr-X
./python/jinja2/infiles drwxrwxr-X
In OS X and SunOS OS there is no exist the 'bash tree command'.
To plot a tree "graph" of folders i use the following instruction:
find . -type d -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
Or this to show files too.
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
But i need another version which contains also the folders rights. Im pretty lost to add on the right side the folder rights. Anyone have any idea ??
Update:
There are any option to plot the files inside the folders and their rights too. I'm trying with this command find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
and doing combination with the solution provided by #fedorqui but the result aren't so good.
That's the result obtained with the above command, without rights.
| | |____src
| | | |____cft2exit.c
| | | |____cft2exit_AIX
| | | |____cft2exit_SUN
| | | |____gestidt.c
| | | |____gestidt.h
| | | |____gestidt.o
| | | |____gestidt_AIX
| | | |____gestidt_SUN
| | | |____gestidt_SunOS
| | | |____makefile
| | | |____sem.a
| | | |____ut_sem.c
| | | |____ut_sem.h
| | | |____ut_sem.o
| |____data
| | |____purge.dat
| |____lost+found
You can execute ls -ld
for each result of find
. It will give you the permissions, other things, and then the file name. If you then pipe to awk, with awk '{print $NF, $1}'
you can print both blocks of information. Finally, you pipe to your sed
command. All together:
find . -type d -exec ls -ld {} \; | awk '{print $NF, $1}' | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
Test
$ find . -type d -exec ls -ld {} \; | awk '{print $NF, $1}' | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
. drwxrwxr-x
|____python drwxrwxr-x
| |____jinja2 drwxrwxr-x
| | |____bk drwxrwxr-x
| | |____infiles drwxrwxr-x
.......
In small steps:
$ find . -type d -exec ls -ld {} \;
drwxrwxr-x 7 me me 4096 Aug 15 15:35 .
drwxrwxr-x 3 me me 4096 Aug 13 14:31 ./python
drwxrwxr-x 4 me me 4096 Apr 26 15:14 ./python/jinja2
drwxrwxr-x 2 me me 4096 Apr 19 14:26 ./python/jinja2/bk
drwxrwxr-x 2 me me 4096 Apr 19 12:54 ./python/jinja2/infiles
and then
$ find . -type d -exec ls -ld {} \; | awk '{print $NF, $1}'
. drwxrwxr-x
./python drwxrwxr-x
./python/jinja2 drwxrwxr-x
./python/jinja2/bk drwxrwxr-x
./python/jinja2/infiles drwxrwxr-x
这篇关于文件夹树权利的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!