Я хочу переместить все файлы и папки внутри папки в другую папку. Я нашел код для копирования всех файлов внутри папки в другую папку. move all files in a folder to anotherперемещать все файлы и папки в папку в другую?
// 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);
}
Как изменить это, чтобы переместить все папки и файлы внутри этой папки в другую папку.
возможный дубликат [Скопировать все файлы и папки из одного каталога в другой каталог PHP] (Http: // StackOverflow. com/questions/1513618/copy-all-files-and-folder-from-one-directory-to-another-directory-php) –