Creating hidden dummy files in empty directories for git
Datum: 19.12.2010 12:18:48When working with symfony and git I often missed empty directories auto generated by symfony on the first commits, which would later be used or needed only for running the app (cache/log), but not having them in vcs for later use annoyed me. So a simple one liner allows you to create an empty .sf-file in each empty directory ignoring empty folders in .git-folders.
find ./ -type d -empty |grep -v '/.git/' | xargs -i touch "{}/.sf"
if you leave away the xargs part (| xargs -i touch "{}/.sf")
find ./ -type d -empty | grep -v '/.git/'you can see a list of the empty directories.
Directories where that can happen:
- test/fixtures/project
- modules-directoriesi
- 18n-directories.
-
And if you want to delete all .sf in a directory:
find ./ -type f -name ".sf" -exec rm {} \;
Trackbacks (0)
Trackbackurl: http://www.robo47.net/trackback/text/42Es sind keine Trackbacks vorhanden.
You liked it ? Link it on your homepage or blog:



Benjamin Steininger ist Webentwickler auf der Suche nach einem neuen Job und
photographiert sehr gerne. Er beschäftigt sich viel mit dem Internet, PHP, Symfony, Testing und hat einen
Kommentare (0)
Es sind noch keine Kommentare vorhanden.
Die Kommentare zu diesem Beitrag sind gesperrt.