Guest User

Untitled

a guest
Jul 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. # Copy any of the bing downloaded images that are used on the windows 10 lock screen.
  3. # Once you set this up you can then set your background to slideshow and point it
  4. # to the archive directory
  5. #
  6. # This was taken from somewhere I'd like to attribute but can't find the URL.
  7. # If this is yours please let me know and I'll attribute you.
  8.  
  9. IMAGE_FOLDER="/mnt/c/Users/jrizzo/AppData/Local/Packages/Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy/LocalState/Assets"
  10. LIST_SOURCE="/mnt/c/tmp/spotlight/listsource.txt"
  11. LIST_TARGET="/mnt/c/tmp/spotlight/listtarget.txt"
  12.  
  13. ls -1 $IMAGE_FOLDER | sort > $LIST_SOURCE
  14.  
  15. ls -1 /mnt/c/tmp/spotlight/*.jpg | awk -F "/" '{gsub(".jpg","",$6);print $6}' | sort > $LIST_TARGET
  16. # egrep -vf $LIST_SOURCE $LIST_TARGET | awk '{system ("rm -f "$1".jpg")}'
  17. for i in `cat $LIST_SOURCE | egrep -vf $LIST_TARGET`
  18. do
  19. varfile="$IMAGE_FOLDER/$i"
  20. file $varfile | grep JPEG | awk -F, '{gsub(" ","",$8);print $8}' | awk -Fx -v vfile=$i -v vfilefull=$varfile '{if ($1>$2 && $1>1280) system("cp "vfilefull" /mnt/c/tmp/spotlight/"vfile".jpg")}'
  21. done
  22.  
  23. ls -1 /mnt/c/tmp/spotlight/*.png | awk -F "/" '{gsub(".png","",$6);print $6}' | sort > $LIST_TARGET
  24. # egrep -vf $LIST_SOURCE $LIST_TARGET | awk '{system ("rm -f "$1".png")}'
  25. for i in `cat $LIST_SOURCE | egrep -vf $LIST_TARGET`
  26. do
  27. varfile="$IMAGE_FOLDER/$i"
  28. file $varfile | grep PNG | awk -F, '{gsub(" ","",$8);print $8}' | awk -Fx -v vfile=$i -v vfilefull=$varfile '{if ($1>$2 && $1>1280) system("cp "vfilefull" /mnt/c/tmp/spotlight/"vfile".png")}'
  29. done
Add Comment
Please, Sign In to add comment