import os | |
import subprocess | |
def git_add_commit_push(file_path): | |
subprocess.call(['git', 'lfs', 'install']) | |
# Git add the file | |
subprocess.call(['git', 'add', file_path]) | |
# Git commit the file | |
subprocess.call(['git', 'commit', '-m', 'Committing {}'.format(file_path)]) | |
# Git push the changes | |
subprocess.call(['git', 'push', 'origin', 'main']) | |
def process_directory(directory_path): | |
# Walk through the directory | |
for root, dirs, files in os.walk(directory_path): | |
for file in files: | |
file_path = os.path.join(root, file) | |
git_add_commit_push(file_path) | |
# Specify the directory you want to process | |
directory_paths = ['raw', 'processed'] | |
# Process the directory | |
for directory_path in directory_paths: | |
process_directory(directory_path) | |