Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save izumiya/261681 to your computer and use it in GitHub Desktop.
Save izumiya/261681 to your computer and use it in GitHub Desktop.
Recursively add .gitignore files to empty dirs
# Recursively add a .gitignore file to all directories
# in the working directory which are empty and don't
# start with a dot. Helpful for tracking empty dirs
# in a git repository.
for i in $(find . -type d -regex ``./[^.].*'' -empty); do touch $i"/.gitignore"; done;
@izumiya
Copy link
Author

izumiya commented Dec 9, 2010

find . ( -type d -empty ) -and ( -not -regex './.git.*' ) -exec touch {}/.gitignore ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment