Created
July 27, 2020 08:17
-
-
Save Colk-tech/b96040ff597dcb9ccb65f12b9090c434 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import datetime | |
import shutil | |
DESKTOP_PATH = os.getenv("USERPROFILE") + r"\Desktop" | |
BACKUP_PATH = os.getenv("ESCAPE-FOLDER") | |
folder_name = BACKUP_PATH + r"/" + datetime.datetime.now().strftime("%Y%m%d%H%M%S") | |
def all_not_shortcuts(): | |
files = os.listdir(DESKTOP_PATH) | |
return [file for file in files if not (file.lower().endswith(".lnk"))] | |
def do_escape(files): | |
os.makedirs(folder_name) | |
for file in files: | |
full_path = DESKTOP_PATH + r"/" + file | |
shutil.move(full_path, folder_name) | |
def main(): | |
targets = all_not_shortcuts() | |
do_escape(targets) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment