UNIX

ディレクトリ内の最古のファイルのタイムスタンプをディレクトリのタイムスタンプに反映

find . -type d | while read -r dir; do touch "$dir" -r "$dir/`ls -t "$dir" | tail -1`"; doneちとめどい.「while read -r dir」と「"$dir"」がポイント. 日本語や空白を含むファイル名をもつファイルに処理を適用するのは↓が定石だが,xargs では 1 …