Skip to content

Instantly share code, notes, and snippets.

@joaopedroaa
Created March 3, 2021 13:53
Show Gist options
  • Select an option

  • Save joaopedroaa/c3426f86c75773c0371718a6ca78c8cd to your computer and use it in GitHub Desktop.

Select an option

Save joaopedroaa/c3426f86c75773c0371718a6ca78c8cd to your computer and use it in GitHub Desktop.
Simple script to move file to folder named "Done"
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