QA Graphic

Make Directory in PHP

None

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 Comments

Name:
Comment:

 

About

As someone who has worked on Macs since 1989, I will use my experience to share tips and tricks with you on Fridays. As a Mac user since 1989, I have seen the evolution of Mac software and hardware, and I know how Mac computers work. I also know how to troubleshoot and fix Mac problems that can arise.

Schedule

ThursdayPython
FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic
Monday Media Monday
TuesdayQA
WednesdaySnagIt for QA