Skip to content

Instantly share code, notes, and snippets.

View ysinha's full-sized avatar

Yash Sinha ysinha

  • Tavisca Solutions Pvt. Ltd.
  • Pune
View GitHub Profile
@ysinha
ysinha / gzipanduploadtos3.ps1
Last active December 20, 2015 15:29
Gzip and upload files to Amazon S3 for static website hosting. Uses Write-GZip community extension cmdlet (http://pscx.codeplex.com/) and S3cmd Amazon S3 command line client (http://s3tools.org/s3cmd). The script takes 3 input parameters - Path to s3cmd client, Name of s3 bucket to upload to and Name of the index document
param([string]$s3cmdpath="D:\s3cmd\s3cmd",[string]$s3bucket="www.example.com",[string]$indexdoc="index.html")
#Gzip compress files with extension .html, .js, .xml, .css
$files = Get-ChildItem -Recurse . -Attributes !Directory #Get all items which are not a directory
$otherfiles = New-Object Object
$otherfiles = @()
$compressextensions = (".html",".js",".xml",".css")
foreach($file in $files)
{