Various touches

This commit is contained in:
Ray 2023-12-14 18:43:06 +11:00
parent 5d5e6eae37
commit dfe5aafc2e
1 changed files with 17 additions and 3 deletions

View File

@ -6,20 +6,34 @@ import shutil
import time import time
# Set the source and destination directories (Replace \ with / before imputting) # Set the source and destination directories (Replace \ with / before imputting)
source = 'C:/Users/User/AppData/Local/Packages/Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy/LocalState/Assets' #Replace "User" with your username source = 'C:/Users/User/AppData/Local/Packages/Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy/LocalState/Assets/' #Replace "User" with your username
destination = '*INSERT USER DIRECTORY HERE* (Example: C:/Users/User/Pictures/Wallpapers/)' destination = 'See Comment next to line for info' # Replace with the directory you want to copy the files to, swapping "\" with "/" Example: 'C:/Users/User/Username/
# Print message stating code has started
print ("Task started, please wait...")
time.sleep(1)
# Copy files from the system directory to a directory of the user's choice # Copy files from the system directory to a directory of the user's choice
for file_name in os.listdir(source): for file_name in os.listdir(source):
if file_name.endswith(''): if file_name.endswith(''):
shutil.copy(os.path.join(source, file_name), destination) shutil.copy(os.path.join(source, file_name), destination)
# Append .jpg to end of file name (Windows doesn't do this automatically)
# UNDER CONSTRUCTION
# Add handling for existing files by skipping them
#elif file_name.endswith('.jpg'):
#continue
# Append .jpg to end of file name (Windows doesn't do this by default)
for filename in os.listdir(destination): for filename in os.listdir(destination):
os.rename(destination + filename, destination + filename + '.jpg') os.rename(destination + filename, destination + filename + '.jpg')
# Print message stating code has executed sucsessfully # Print message stating code has executed sucsessfully
print ("Task completed succsessfully, please look at destination folder for results.") print ("Task completed succsessfully, please look at destination folder for results.")
# Delay closing of window by 5 seconds # Delay closing of window by 5 seconds
time.sleep(5) time.sleep(5)