Skip to content

Instantly share code, notes, and snippets.

View dipnlik's full-sized avatar

Alexandre Lima dipnlik

View GitHub Profile
@dipnlik
dipnlik / ratio_organizer.sh
Created December 10, 2012 20:50 — forked from metalrufflez/wallpaper_organizer.sh
Organize wallpapers according to aspect ratio
#!/bin/bash
shopt -s nullglob # won't error if a glob has no match
wallpaper_dir="$HOME/Dropbox/Photos/Wallpapers"
cd $wallpaper_dir
files=(*jpg *jpeg *png *bmp)
for file in "${files[@]}"
do read -r width height <<< $(sips -g pixelWidth -g pixelHeight "$file" | awk '/pixel(Width|Height)/ {print $2}')