Created
June 23, 2019 16:14
-
-
Save gdvalle/cc798c70cc364a05748addf6221a5bec to your computer and use it in GitHub Desktop.
Delete extracted mkv files alongside rar parts.
This file contains 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
#!/usr/bin/env python3 | |
import os | |
import sys | |
assert sys.version_info[:2] >= (3, 6), "Requires Python 3.6+" | |
def walk_dir(directory): | |
for root, dirs, files in os.walk(directory): | |
mkvs = [] | |
has_rars = None | |
for fname in files: | |
if fname.endswith(".r02"): | |
has_rars = True | |
if fname.endswith(".mkv"): | |
mkvs.append(fname) | |
if has_rars is True and mkvs: | |
for mkv in mkvs: | |
path = os.path.join(root, mkv) | |
print(path) | |
return 0 | |
if __name__ == "__main__": | |
sys.exit(walk_dir(os.path.curdir)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment