Created
February 7, 2017 00:59
-
-
Save Tomasz-Silpion/a0b76d76880830d1ec937eac40d29aed to your computer and use it in GitHub Desktop.
Script for parsing Google PageSpeed optimized content MANIFEST
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script for parsing Google PageSpeed optimized content MANIFEST | |
# Copyright (C) 2016 Tomasz Silpion Gregorczyk - All Rights Reserved | |
file="MANIFEST" | |
while IFS= read line | |
do | |
#strip file paths | |
IFS=':' read -r src protocol url <<EOF | |
$line | |
EOF | |
#remove protocol double slash left in url | |
path=`echo $url | sed 's/\/\///'` | |
if test -n "$path"; then | |
mkdir -p -- "${path%/*}" && touch -- "$path" | |
cp $src $path | |
fi | |
done <"$file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment