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.
フォルダー内のすべてのファイルを再帰的に gzip し、圧縮後に元の名前と拡張子を保持したい。
私はsudoを試しましたが、Amazon S3にアップロードするgzipされたファイルの名前を保持したい場合gzip -9 -r folderなど、各ファイルにはオリジナルに.gz拡張子が追加されています。2852b65c1d8b.css.gz2852b65c1d8b.css
gzip -9 -r folder
2852b65c1d8b.css.gz
2852b65c1d8b.css
これを使用すると、必要な処理が実行されます。
find folder -type f -exec gzip -9 {} \; -exec mv {}.gz {} \;
最初のexecはファイルをgzipで圧縮し、2番目のexecはファイルの名前を変更します。