""" This script pulls the files from your dual front + rear facing dashcam and moves them to the specified directory, leaving the card formatted, empty, and ready to go for your next drive Merely modify SOURCE and DESTINATION to the desired paths. Your SOURCE must have two directories named 1 and 2,containing the video files, since this is a common way dashcam filesystems are formatted. DESTINATION is the directory where you would like your videos to go to. The script will create a directory titled (month)-(day) and then two directories named 1 and 2, much like the source directory. Ryan Prasad 10/20/2021 """ import datetime import os import shutil def move_files(source=str, destination=str): os.chdir(source) files = os.listdir() file_paths = [] for file in files: file_paths.append(os.path.join(source, file)) for file in file_paths: shutil.move(file, destination) def main(): # Specify paths here. Source folder must have files in two folders: 1 and 2, as mosh dashcams are formatted SOURCE = r"E:\DCIM" DESTINATION = r"D:\Dashcam" date = datetime.datetime.now().strftime("%m-%d") # Make directories in destination folder os.chdir(DESTINATION) os.mkdir(date) os.chdir(os.path.join(DESTINATION, date)) os.mkdir("1") os.mkdir("2") # Move files over, keeping source directory structure intact move_files(os.path.join(SOURCE, "1"), os.path.join(DESTINATION, date, "1")) move_files(os.path.join(SOURCE, "2"), os.path.join(DESTINATION, date, "2")) if __name__ == '__main__': main()