Created
August 19, 2022 17:44
-
-
Save kieranjol/8fcababb678aeca21f05362991604eeb 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
``` | |
Find an mkv file, move all sibling files up one directory. only use once as it will keep moving up forever. | |
``` | |
import sys | |
import os | |
import shutil | |
source = sys.argv[1] | |
for root, dirnames, filenames in os.walk(source): | |
for filename in filenames: | |
if filename.endswith('.mkv'): | |
file_list = os.listdir(root) | |
for sip_file in file_list: | |
if sip_file == '.DS_Store': | |
continue | |
full_path = os.path.join(root, sip_file) | |
shutil.move(full_path, os.path.dirname(root)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment