
私はSynology NAS(BusyBox実行)でbashを使用しています。最近、オペレーティングシステムを再インストールする必要がありました。これでduを使用してフォルダサイズを含むファイルを生成するスクリプトは失敗します。 duには、オプションが少ないからです。つまり
du -hc --max-depth=1 --exclude=deleted --exclude=README.txt --exclude=#recycle /path/to/event_media/* >> /path/to/media_files_list.txt
私にしてください:
du: unrecognized option '--max-depth=1'
だから私はいつ...
du --help
わかりました..
BusyBox v1.16.1 (2014-05-29 11:29:56 CST) multi-call binary.
Usage: du [-aHLdclsxhmk] [FILE]...
Summarize disk space used for each FILE and/or directory.
Disk space is printed in units of 1024 bytes.
Options:
-a Show file sizes too
-L Follow all symlinks
-H Follow symlinks on command line
-d N Limit output to directories (and files with -a) of depth < N
-c Show grand total
-l Count sizes many times if hard linked
-s Display only a total for each argument
-x Skip directories on different filesystems
-h Sizes in human readable format (e.g., 1K 243M 2G )
-m Sizes in megabytes
-k Sizes in kilobytes (default)
オプションセットが縮小されました。
変更された内容と最大深度と除外など、完全なオプションセットに再アクセスするように設定する方法を理解するのに役立つ人はいますか?
答え1
答え2
私はこの時点で最も重要な答えがより明確になりたいだけです。
busyboxでは引き続きmax-depth=#
使用できますが、du
次のように変更してください。
du --max-depth=#
# Becomes
du -d #
除外フォルダの場合、パラメータは存在しない可能性がありますが、目的のフォルダのみを選択できます。
du --exclude folder3
# Becomes
du folder1 folder2 folder4