|
|
|
<?
/* ### Recursive move/copy function ###
Sometimes we need to move/copy a complete directory structure.
It is dangerous to trust on the OSes utilities, so I thought the best was to build my own function to such tasks.
Given a source dir. and a dest dir., the function finds all files and directories on source, and calls itself when it
finds another directory.
It is very simple to understand, and works very fast.
Have fun...
*/
function mover($src,$dst) {
$handle=opendir($src); // Opens source dir.
if (!is_dir($dst)) mkdir($dst,0755); // Make dest dir.
while ($file = readdir($handle)) {
if (($file!=".") and ($file!="..")) { // Skips . and .. dirs
$srcm=$src."/".$file;
$dstm=$dst."/".$file;
if (is_dir($srcm)) { // If another dir is found
mover($srcm,$dstm); // calls itself - recursive WTG
} else {
copy($srcm,$dstm);
unlink($srcm); // Is just a copy procedure is needed
} // comment out this line
}
}
closedir($handle);
rmdir($src); // and this one also :)
}
?> |
|
| These 2 functions write and read the contents of a specially designated multi-dimensional array to and from a text file. Categories : Algorithms, PHP, Filesystem | | | Kasskooye($path) tell you the complete size of a folder
Categories : PHP, Algorithms, Utilities, Filesystem | | | file class , uploade file , download file already uploaded on another website Categories : PHP, PHP Classes, Filesystem, Web Services | | | Dollar Serial Number Validator Categories : PHP, Security, Algorithms | | | Introduction to Language Files Categories : PHP, Filesystem, Beginner Guides | | | A flat file counter Categories : PHP, Cookies, Filesystem, Beginner Guides | | | Show Source with Line Numbers Categories : PHP, Regexps, Filesystem | | | A very simple and efficient split bar the B-Z bar , for mysql and php ...
Tired of obfuscated code try this one ...
Categories : PHP, Databases, MySQL, Algorithms | | | PHP Function to Encrypt/Decrypt a string without a known key. The string itself has his own different key for every character. Categories : PHP, Algorithms, Security, Authentication, Encryption | | | IPhider Obscure Any URL Anonymity connection lores obfuscation corporate survival. Categories : PHP, Algorithms, Security, URLs | | | Creating a Language File Categories : PHP, Beginner Guides, Filesystem | | | Credit Card Identification and Validation Class - The credit_card class provides methods for cleaning, validating and identifying the type of credit card numbers. Categories : PHP, PHP Classes, Credit Cards, Ecommerce, Algorithms | | | Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET Categories : Algorithms, HTML and PHP, PHP, Variables | | | A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL | | | Random Image Display Categories : PHP, Filesystem, Graphics, HTML and PHP | |
|
|
|