A PHP script for removing Thumbs.db, .DS_Store, MacOS hidden and other annoying files +

Tired of explaining to others how to turn off thumbnail caching on Windows, how to install TinkerTool on Mac? Deleted your fair share of those damn files manually? Me too! Never again!

/**
* housekeeping.php
*
* Removes various annoying hidden and/or useless files leftover from
* different people doing different stuff on the filesystem using
* various OSes.
*/

Source: housekeeping.php (5KB, .phps file)

When and how you invoke the function (cron or scheduled tasks, manually, before/after/during some scm process, on login/logout…) is up to you.

Questions, comments, etc — use the form below. Enjoy nuking those files.

4 Responses to “A PHP script for removing Thumbs.db, .DS_Store, MacOS hidden and other annoying files”

  1. Thnx, works like a charm :)

  2. I have downloaded the housekeeping.php file how to run this in windows it asking me program to open

    help plz

    Syed

  3. @syed:
    this is an excerpt from the comments from the file you downloaded:

    * @usage rdir_cleanup(’.'); // just a ‘test-run’ in the current working dir
    * @usage rdir_cleanup(’.', true); // nuke everything from the cwd and further below

    So, housekeeping.phps just gives you a function, that you can use in your own php script, that is yet to be writtten (and ran after that) by you. To do that on a default Windows box, you’ll probably have to do all or some of these steps:

    step 1: download and install php so you can run php scripts on your computer
    step 2: open go to the folder where you saved housekeeping.phps and rename it to housekeeping.php
    step 3: open housekeeping.php with a text editor and add one extra line to the bottom (call the rdir_cleanup() function with parameters that suit you)
    step 4: fire up command prompt (Win+R, type in cmd, hit enter), go to the folder where housekeeping.php is, and now finally type “php housekeeping.php” (without quotes) in the command-line — that runs the script.

    Steps 2-4 could maybe be avoided by installing php with a windows installer that automagically assigns .php files to the php interpreter, so you could maybe just double-click .php files in windows explorer to run them. Haven’t tried it tho.

  4. Very useful! Thanks

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">