Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ファイルを NAS の以下のディレクトリに再同期する bash スクリプトがあります。
mkdir /backup/folder_`date +%F`
ディレクトリ名の日付に基づいて、7 日以上前のディレクトリを削除するクリーンアップ スクリプトを作成するにはどうすればよいですか?
簡単な検索はどうですか:
find /backup -name 'folder_*' -type d -ctime 7 -exec rm -rf {} \;
削除したいパターンのフォルダーのリストを作成し、保持したいフォルダーをリストから削除し、それ以外はすべて削除します。