Copy code code as follows:
<?php
/*
Code features: Use PHP to skillfully store pictures by creation time;
Picture file properties must cancel read-only property, otherwise you cannot remove
by lost63
/
//Delay setting
Set_time_limit (0);
$path = ' c:\ recovery file \ Graphics $ picture \jpeg image (. jpg) ';
$result =dir ($path);
while ($value = $result->read ()) {
If Strpos ($value, '. JPG ') ==true| | Strpos ($value, '. jpg ') ==true| | Strpos ($value, '. gif ') ==true| | Strpos ($value, '. png ') ==true) {
//Set up if the folder does not exist;
$fileNewPath = $path. ' \ filetime ($path. ' \ $value);
if (!file_exists ($fileNewPath)) {
mkdir ($fileNewPath);
}
MoveFile ($path. ' \ $value, $fileNewPath. ' \ $value);
}
//Get File modification time
Function filetime ($str) {
Return date ("Y-m-d", Filemtime ($STR));
}
//Move file to new address
function MoveFile ($file, $path) {
Copy ($file, $path);
Echo $file. ' Location update complete <br> ';
Unlink ($file);
Echo $file. ' Original location file deleted ';
}
?>