QA Graphic

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

Name:
Comment:

 

About

A Mac veteran since 1989, I'm here to share my experience with tips and tricks every Friday. Witnessing the evolution of Mac software and hardware firsthand, I've gained a deep understanding of how these machines work and can help you troubleshoot any issues that may come up.

Schedule

Sunday 22 Misc
Monday 23 Media
Tuesday 24 QA
Wednesday 25 Pytest
Thursday 26 PlayWright
Friday 27 Macintosh
Saturday 28 Internet Tools