در صورتی که قصد دارید تمام فایل های موجود در یک فلدر را به فلدر دیگر توسط 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);
$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);
سایر مقالات مرتبط :
- برد هوشمند چیست؟ + نحوه استفاده از وایت برد هوشمند
- راهنمای خرید عمده لوازم جانبی کامپیوتر
- افزایش سرعت سایت های شلوغ
- معرفی دستگاه ماینر واتس ماینر Whatsminer M32 68Th
- وب سرور چیست؛ هر آنچه باید از وب سرور بدانید!
- روش کار با php unit test
- برنامه نویسی اندروید و همه چیز درباره آن
- بهترین مدل مانتو شلوار اداری برای مصاحبه شغلی
- آفر ویژه تورتایلند 7شب را در لحظه آخر ببینید
- آشنایی با بهترین نرم افزار CRM
- بررسی بروکرهای کارگزاریهای آلپاری فارکس و فیبوگروپ
- نکات کاربردی در مورد طراحی ویلا