Created
January 8, 2020 01:22
-
-
Save theeluwin/c4d849f4f22e6ca7914cea4322b96ca8 to your computer and use it in GitHub Desktop.
gitignore 되어있는 폴더 트리를 구조만 유지하고 싶을때 .keep을 추가해서 처리
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
# -*- coding: utf-8 -*- | |
import os | |
import subprocess | |
def entry(): | |
for root, _, _ in os.walk('.', topdown=True): | |
if root == '.': | |
continue | |
path = os.path.join(root, '.keep') | |
with open(path, 'w') as _: | |
pass | |
subprocess.call(['git', 'add', '-f', path]) | |
if __name__ == '__main__': | |
entry() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment