سفارش تبلیغ
صبا ویژن
آمیزگارى با مردمان ایمنى است از گزند آنان . [نهج البلاغه]
 
دوشنبه 95 اردیبهشت 6 , ساعت 11:50 صبح

در صورتی که قصد دارید تمام فایل های موجود در یک فلدر را به فلدر دیگر توسط php انتقال دهید می توانید از کد زیر استفاده نمایید.

// Get array of all source files
$files = scandir("source");
// Identify directories
$source = "source/";
$destination = "destination/";
// Cycle through all source files
foreach ($files as $file) {
if (in_array($file, array(".",".."))) continue;
// If we copied this successfully, mark it for deletion
if (copy($source.$file, $destination.$file)) {
$delete[] = $source.$file;
}
}
// Delete all successfully-copied files
foreach ($delete as $file) {
unlink($file);
}
سورس:


لیست کل یادداشت های این وبلاگ