看见漂亮的win10锁屏文件,该如何得到源文件呢?
利用下面的python程序,拷贝源文件,并重新命名,即可在其他地方使用。
# coding = 'utf-8'
#将win10锁屏图片整理出来
import os
from os.path import getsize
import shutil
class Get_win_pic():
#图片位置
rpath = 'C:\\Users\\wq\\AppData\\Local\\Packages\\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\\LocalState\Assets\\'
#目标位置
wpath = 'C:\\Users\\wq\\Desktop\\win_pic\\'
def __init__(self):
self.files = []
def readFile(self):
for parent, dirnames, filenames in os.walk(Get_win_pic.rpath):
pass
self.files = filenames
def writeFile(self):
for file in self.files:
# size bigger than 300KB and not exists
if getsize(Get_win_pic.rpath + file) > 307200 and not os.path.exists(Get_win_pic.wpath + file + '.jpg'):
try:
shutil.copy(Get_win_pic.rpath + file, Get_win_pic.wpath)
os.chdir(Get_win_pic.wpath)
os.rename(file, file + '.jpg')
except Exception as err:
print(err)
if __name__ == '__main__':
gwp = Get_win_pic()
gwp.readFile()
gwp.writeFile()