December 30, 2003

Make Directory in PHP

Since March, 2002 I have been keeping track of my daily work by creating a folder on the desktop. This folder has the current date, so its easy to find something work I did for any particular date. This also handy for DVD and CD backup of my work.

This morning I decided to automate creating a daily folder by installing some PHP code into my index.php file. This way everytime I open up my web browser, a new folder is created on the desktop only if there isn't already one created.

<?
// Create a Directory for Today's Work
$name = date('n.d.y');
if (!is_dir("/Users/$user/Desktop/$name")) {
mkdir("/Users/$user/Desktop/$name", 0777 );
chmod( "/Users/$user/Desktop/$name", 0777 );
}
?>

Comments

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!