From 0ea6b22f3de5c9b0acd2e5a8ed46dbb5cb111e16 Mon Sep 17 00:00:00 2001 From: SowinskiBraeden Date: Sat, 9 Nov 2024 23:28:38 -0800 Subject: [PATCH] initial commit --- sort_captures.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 sort_captures.py diff --git a/sort_captures.py b/sort_captures.py new file mode 100755 index 0000000..3c116ed --- /dev/null +++ b/sort_captures.py @@ -0,0 +1,13 @@ +#!/usr/bin/python +import glob +import os + +base_path: str = "" +captures: [str] = glob.glob(glob.escape(base_path) + "/*.mp4") + +for capture in captures: + filename: str = capture.split(base_path)[1] # get filename + game: str = filename.split('202')[0][1:] # get game name from filename + while game.endswith(' '): game = game[:-1] # clear excess spaces from end of game name + if not os.path.exists(f'{base_path}/{game}'): os.mkdir(f'{base_path}/{game}') # create game dir if not exists + os.rename(f'{base_path}/{filename}', f'{base_path}/{game}/{filename}') # move file to game dir