Skip to content

Instantly share code, notes, and snippets.

@flashblaze
Created February 19, 2020 11:10
Show Gist options
  • Select an option

  • Save flashblaze/b7e091a14093aa9f10fc5e38f7e0b5bf to your computer and use it in GitHub Desktop.

Select an option

Save flashblaze/b7e091a14093aa9f10fc5e38f7e0b5bf to your computer and use it in GitHub Desktop.
import os
# Change this path accordingly
dir_path = "G:\\"
names = os.listdir(dir_path)
for name in names:
if(os.path.isdir(dir_path+name)):
count = 0
os.chdir(dir_path + name)
sub_dirs = os.listdir()
for sub_dir in sub_dirs:
if(sub_dir == '.git'):
os.system('git pull origin master')
break
else:
count += 1
if(count == len(sub_dirs)-1):
os.chdir(dir_path)
with open('not_git_dirs.txt', 'a+') as file:
file.write(name+'\n')
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment