Saturday, April 3, 2010

Ignoring Temporary Files




Both Windows and OS X write temporary/hidden files used to store additional information about files (such as a thumbnails of photos, or in which direction files should be displayed in a folder).

While these can be useful when browsing files on the operating system, they can cause a bit of clutter.

SabreDAV comes with a plug-in you can easily add that will hide these files. It writes them to a temporary directory rather than your WebDAV files directory.

The name of this plug-in is Sabre_DAV_TemporaryFileFilterPlugin. You can pass the path where temporary files should be stored as the its only argument, or you can leave this blank and it will use the system temporary directory.
Caution: SabreDAV will not automatically clean up this directory. You should manually clear this write a cron job that will do so for you.

The following list shows how you can use this plug-in. Just like with any other plug-in it is added using the addPlugin() method.
Listing 6 Automatically filtering resource forks with built-in plug-in (listing-6.php)

addPlugin(
new Sabre_DAV_TemporaryFileFilterPlugin()
);

$server->exec();
?>

No comments:

Post a Comment