octobercms/october · error · ApplicationException
editor::lang.filesystem.error_moving_directory
Error message
editor::lang.filesystem.error_moving_directory
What it means
Thrown by editorMoveFilesOrDirectories when @File::copyDirectory() fails while moving a directory (lines 216-222). Message: 'Error moving directory :dir'. Directories are moved by copy-then-delete (works across devices), and copyDirectory aborts on the first file that cannot be written — typically the destination is not writable by the PHP user or the disk is full. IMPORTANT: this throws AFTER copying may have partially succeeded, and the original directory is left untouched.
Source
Thrown at modules/editor/traits/FileSystemFunctions.php:218
if ((is_file($originalFullPath) && is_file($newFullPath))
|| (is_dir($originalFullPath) && is_dir($newFullPath))) {
throw new ApplicationException(Lang::get(
'editor::lang.filesystem.destination_exists',
['name' => $basename]
));
}
if (is_file($originalFullPath)) {
if (!@File::move($originalFullPath, $newFullPath)) {
throw new ApplicationException(Lang::get(
'editor::lang.filesystem.error_moving_file',
['file' => $basename]
));
}
}
elseif (is_dir($originalFullPath)) {
if (!@File::copyDirectory($originalFullPath, $newFullPath)) {
throw new ApplicationException(Lang::get(
'editor::lang.filesystem.error_moving_directory',
['dir' => $basename]
));
}
if (strpos($originalFullPath, '../') !== false) {
throw new ApplicationException(Lang::get(
'editor::lang.filesystem.error_deleting_directory',
['dir' => $basename]
));
}
if (strpos($originalFullPath, $safeDir) !== 0) {
throw new ApplicationException(Lang::get(
'editor::lang.filesystem.error_deleting_directory',
['dir' => $basename]
));
}View on GitHub (pinned to b608633a7e)
Solutions
- Make the destination directory writable by the PHP user (chown/chmod -R), then retry and clean up any partial copy
- Check disk space (df -h) and free space if full
- Identify unreadable files inside the source tree (permissions on individual files) and fix them
- After any failed dir move, compare source and destination trees and delete the partial copy before retrying
Example fix
# before: partial copy left in destination $ sudo rm -rf themes/demo/assets/img/archive-lib $ sudo chown -R www-data:www-data themes/demo/assets/img # retry the move — full tree now copies, original is deleted after
Defensive patterns
Strategy: try-catch
Validate before calling
if (!is_writable($destinationFullPath) || disk_free_space($assetsBase) < $expectedTreeSize) {
// dir moves are copy+delete: destination must be writable AND disk must fit the tree
} Try / catch
use October\Rain\Exception\ApplicationException;
try {
if (!@File::copyDirectory($originalFullPath, $newFullPath)) {
throw new ApplicationException(Lang::get('editor::lang.filesystem.error_moving_directory', ['dir' => $basename]));
}
} catch (ApplicationException $e) {
// original tree is intact; remove the partial copy before any retry
@File::deleteDirectory($newFullPath);
throw $e;
} Prevention
- Remember directory moves copy first — always delete partial copies after failures
- Keep destinations writable and disks above a healthy free-space margin
- Fix permissions on individual files inside large trees before moving them
When it happens
Trigger: Thrown at modules/editor/traits/FileSystemFunctions.php:218 when the library encounters an invalid state.
Common situations: Deep asset trees where the destination was auto-created with different ownership; low disk space on the theme volume; one locked/unreadable file inside the tree aborting the whole copy; retries after partial copies leaving duplicated content.
Related errors
- editor::lang.filesystem.error_renaming
- editor::lang.filesystem.error_deleting_file
- editor::lang.filesystem.error_deleting_dir
- editor::lang.filesystem.error_moving_file
- editor::lang.filesystem.destination_not_found
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/066edf15bb043267.
Report an issue: GitHub.