Created
February 5, 2023 03:02
-
-
Save matthewdeanmartin/e8af93e8cd0f49dd39983613f337ac56 to your computer and use it in GitHub Desktop.
Fixes Chmod+x for all the bash files on Windows.
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
import os | |
import subprocess | |
def run_git_command(directory: str, file: str): | |
os.chdir(directory) | |
subprocess.run(['git', 'add', '--chmod', '+x', file]) | |
def find_git_repos(root_dir: str) -> tuple[str, str]: | |
for dirpath, dirnames, filenames in os.walk(root_dir): | |
if '.git' in dirnames: | |
for filename in filenames: | |
if filename.endswith('.sh'): | |
yield (dirpath, filename) | |
if __name__ == '__main__': | |
root_dir = 'e:\\repos' | |
for directory, filename in find_git_repos(root_dir): | |
run_git_command(directory, filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment