最佳答案
在linux中是否有一种方法来限制递归文件列表的深度?
我现在使用的命令是:
ls -laR > dirlist.txt
我有大约200个目录,每个目录有10个目录。所以这会花费很长时间,占用太多系统资源。
我真正感兴趣的是第一级子目录的所有权和权限信息:
drwxr-xr-x 14 root root 1234 Dec 22 13:19 /var/www/vhosts/domain1.co.uk
drwxr--r-- 14 jon root 1234 Dec 22 13:19 /var/www/vhosts/domain1.co.uk/htdocs
drwxr--r-- 14 jon root 1234 Dec 22 13:19 /var/www/vhosts/domain1.co.uk/cgi-bin
drwxr-xr-x 14 root root 1234 Dec 22 13:19 /var/www/vhosts/domain2.co.uk
drwxr-xrwx 14 proftp root 1234 Dec 22 13:19 /var/www/vhosts/domain2.co.uk/htdocs
drwxr-xrwx 14 proftp root 1234 Dec 22 13:19 /var/www/vhosts/domain2.co.uk/cgi-bin
drwxr-xr-x 14 root root 1234 Dec 22 13:19 /var/www/vhosts/domain3.co.uk
drwxr-xr-- 14 jon root 1234 Dec 22 13:19 /var/www/vhosts/domain3.co.uk/htdocs
drwxr-xr-- 14 jon root 1234 Dec 22 13:19 /var/www/vhosts/domain3.co.uk/cgi-bin
drwxr-xr-x 14 root root 1234 Dec 22 13:19 /var/www/vhosts/domain4.co.uk
drwxr-xr-- 14 jon root 1234 Dec 22 13:19 /var/www/vhosts/domain4.co.uk/htdocs
drwxr-xr-- 14 jon root 1234 Dec 22 13:19 /var/www/vhosts/domain4.co.uk/cgi-bin
编辑:
最终的命令选择:
find -maxdepth 2 -type d -ls >dirlist