Skip to content

Commit

Permalink
Create parent folders if necessary at target path
Browse files Browse the repository at this point in the history
  • Loading branch information
richard67 authored and dgrammatiko committed Nov 22, 2021
1 parent d6c9de1 commit a89990c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions administrator/components/com_admin/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -8516,9 +8516,15 @@ protected function moveRemainingTemplateFiles()
$newPath = Path::clean(JPATH_ROOT . $newFolder);

// Handle all files in this folder and all sub-folders
foreach (Folder::files($oldPath, '.*', true, true) as $file)
foreach (Folder::files($oldPath, '.*', true, true) as $oldFile)
{
File::move($file, $newPath . substr($file, strlen($oldPath)));
$newFile = $newPath . substr($oldFile, strlen($oldPath));

// Create target folder and parent folders if they doen't exist yet
if (Folder::create(\dirname($newFile)))
{
File::move($oldFile, $newFile);
}
}
}
}
Expand Down

0 comments on commit a89990c

Please sign in to comment.