是否有仅获取最深目录的通用解决方案?计算斜杠字符不起作用,因为如果我更改为--max-depth=4
,最深的目录将不会都有相同数量的斜杠。
指示的两个目录<<<<
是我想要的。
-bash-4.1$ du --max-depth=3 -h /Database/9.6/backups > x.x
du: cannot read directory `/Database/9.6/backups/lost+found': Permission denied
-bash-4.1$ cat x.x
16K /Database/9.6/backups/lost+found
142G /Database/9.6/backups/pgbackrest/archive/localhost <<<<
142G /Database/9.6/backups/pgbackrest/archive
4.9T /Database/9.6/backups/pgbackrest/backup/localhost <<<<
4.9T /Database/9.6/backups/pgbackrest/backup
5.0T /Database/9.6/backups/pgbackrest
5.0T /Database/9.6/backups