Created
March 3, 2021 13:53
-
-
Save joaopedroaa/c3426f86c75773c0371718a6ca78c8cd to your computer and use it in GitHub Desktop.
Simple script to move file to folder named "Done"
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
| from os import listdir | |
| from os.path import isfile, join | |
| import shutil | |
| mypathtodo = "./" | |
| mypathdone = "./Done/" | |
| mytype = "mkv" | |
| onlyfiles_todo = sorted([file for file in listdir(mypathtodo) if isfile(join(mypathtodo, file)) and file[file.find(".", -4) + 1:] == mytype]) | |
| onlyfiles_done = sorted([file for file in listdir(mypathdone) if isfile(join(mypathdone, file)) and file[file.find(".", -4) + 1:] == mytype]) | |
| def main(): | |
| for pos, file in enumerate(onlyfiles_todo): | |
| print(f"({pos:02d}) {file}") | |
| donefile = int(input("Done (0 is deault): ") or 0) | |
| shutil.move(join(mypathtodo, onlyfiles_todo[donefile]), mypathdone) | |
| print(f"{onlyfiles_todo[donefile]} has moved to done") | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment