Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
gzip octopress files and sync them to S3 and CloudFront with s3cmd. Original script by Julian Schrittwieser ( -
# compress the files if they aren't
find public/ -iname '*.html' -exec ./ {} \;
find public/ -iname '*.js' -exec ./ {} \;
find public/ -iname '*.css' -exec ./ {} \;
# change their name back
find public -iname '*.gz' -exec bash -c 'mv $0 ${0/.gz/}' {} \;
echo "gzipping successful"
echo "syncing gzipped files"
s3cmd sync --progress --acl-public --reduced-redundancy --cf-invalidate --verbose --cf-invalidate-default-index --add-header 'Content-Encoding:gzip' public/* s3://$1/ --exclude '*.*' --include '*.html' --include '*.js' --include '*.css'
echo "syncing gzipped files complete"
echo "syncing non-gzipped files"
s3cmd sync --progress --acl-public --reduced-redundancy --cf-invalidate --verbose public/* s3://$1/ --exclude '*.html' --exclude '*.js' --exclude '*.css'
echo "syncing non-gzipped files complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.