Skip to content

Instantly share code, notes, and snippets.

@kieranjol
Created August 19, 2022 17:44
Show Gist options
  • Save kieranjol/8fcababb678aeca21f05362991604eeb to your computer and use it in GitHub Desktop.
Save kieranjol/8fcababb678aeca21f05362991604eeb to your computer and use it in GitHub Desktop.
```
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