Skip to content

Instantly share code, notes, and snippets.

@shibatch
Created July 25, 2018 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shibatch/f0284e3d5bcda8369b2f7a9b4fe49872 to your computer and use it in GitHub Desktop.
Save shibatch/f0284e3d5bcda8369b2f7a9b4fe49872 to your computer and use it in GitHub Desktop.
Cygwin shell script for automatically collecting Windows spotlight wallpapers
#!/usr/bin/bash
PATH=/bin:/usr/bin:$PATH
LASTDATE=INIT
while true; do
CURDATE=`date +'%D'`
if [ "$CURDATE" != "$LASTDATE" ]
then
for i in `cygpath $USERPROFILE`/AppData/Local/Packages/Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy/LocalState/Assets/*; do
if [ "`file $i | perl -pe 's|.* ([0-9]+x[0-9]+),.*|\1|'`" = 1920x1080 ]
then
cp -uv $i /cygdrive/d/wallpaper_horizontal/`basename $i`.jpg
fi
if [ "`file $i | perl -pe 's|.* ([0-9]+x[0-9]+),.*|\1|'`" = 1080x1920 ]
then
cp -uv $i /cygdrive/d/wallpaper_vertical/`basename $i`.jpg
fi
done
fi
LASTDATE=$CURDATE
sleep 600
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment