Easy folder structure set up


/ Published in: PHP
Save to your folder(s)

Here is a function you can use to automatically set up a complex folder structure with a specified file mode. All you have to do is create the "root" directory and pass an array describing the folder structure you would like to create in it. If the directory already contains a part of the desired directory structure, the script will set the specified file mode on every existing folder. There's an example how to use the function at the bottom of the snippet.

I use this to set up user home's. I tested this with PHP 5.2.11 on Apache running on Mac OS X. It should work on most Linux servers. It won't work on Windows.

This function should be easy to modify for your needs or integrate into a class. Have fun.

URL: http://www.chlab.ch/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.