CakePHP “empty” Files in Each Directory

October 23rd, 2009 1:01 pm / Posted in CakePHP by Karl

If you use CakePHP you have probably noticed that each empty directory contains a file named “empty” which is, unsurprisingly, empty. The purpose of this file is to allow the CakePHP project to be managed via Git, which tracks only files and not directories. In order to add a directory to a project, it must contain a file.

Usually this isn’t a problem, you can just ignore these files, but if you want to revision control your source code (which is always a good idea), you probably don’t want to include these empty files. Here is a quick and easy way to get rid of them before your initial import:

1
2
$ cd /path/to/your/working/directory
$ find . -type f -name 'empty' -print0 | xargs -0 rm -rdf

You should now be a few dozen empty files lighter.

Leave a Reply

You can use the following tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>