Created
May 4, 2015 13:18
-
-
Save pavgup/60e960572bd4ba01df90 to your computer and use it in GitHub Desktop.
Before a magical image optimization pipeline kicks off (e.g., imagemin inside grunt/gulp) you'd probably want to know what the size of all your images are. Here's a quick one-liner that grabs a filetype for every file inside your current directory and then awks out the files that *nix is considering an image before finally handing off the file s…
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
#!/bin/sh | |
# Before a magical image optimization pipeline kicks off (e.g., imagemin inside | |
# grunt/gulp) you'd probably want to know what the size of all your images are. | |
# Here's a quick one-liner that grabs a filetype for every file inside your | |
# current directory and then awks out the files that *nix is considering an | |
# image before finally handing off the file size calculations to du. | |
find . -exec file {} \; | \ | |
awk -F':' '{ | |
if ($2 ~/[Ii]mage|EPS/) | |
print $1,"\n" | |
}' | \ | |
xargs du -hc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment