Creating hidden dummy files in empty directories for git

Flattr this
Tweet this: Creating hidden dummy files in empty directories for git
Dent this: Creating hidden dummy files in empty directories for git
Tags: bash, Git, Linux, Symfony
Datum: 19.12.2010 12:18:48

When 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/42

Es sind keine Trackbacks vorhanden.


Kommentare (0)

Es sind noch keine Kommentare vorhanden.

Die Kommentare zu diesem Beitrag sind gesperrt.

You liked it ? Link it on your homepage or blog: