Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alimisumanth/cd2f8eb8e727d28dc3a967108137b111 to your computer and use it in GitHub Desktop.
Save alimisumanth/cd2f8eb8e727d28dc3a967108137b111 to your computer and use it in GitHub Desktop.
Automated Python Script to download windows spotight images
import os
import shutil
user = os.environ['USERNAME']#To get the user's username
#storing the default spotlight lockscreen images in a variable named soure_folder
source_folder=r'C:\Users\\'+user+'\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets'
#prompt to get custom destination path from user
destination_folder = input('Do you want to choose custom destination folder? if yes provide the path else press enter')
if len(destination_folder)<1 and not os.path.isdir(destination_folder):
destination_folder=os.getcwd()
#Copying the files to destination path and adding .png extension to it
for f in os.listdir(source_folder):
if os.path.isfile(source_folder+'//'+f):
if (not f.endswith('png')) and (not f.endswith('.py')):
shutil.copyfile(source_folder+"\\"+f,destination_folder+'\\'+f+'.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment