Class MoveDirectory
java.lang.Object
io.github.raghultech.openloom.fs.MoveDirectory
================================================================
📂 MoveDirectory - Directory Move Utility
================================================================
Overview: Provides a robust method to move directories from a source path to a target path. Supports optional replacement of existing directories and prevents moving a directory into itself or its subdirectories.
Important: This class is protected and intended for internal usage.
End-users should access directory move operations via FileManager:
OpenLoom loom = new OpenLoom();
loom.file().moveDir(Paths.get("C:/sourceDir"), Paths.get("C:/targetDir"), true);
Key features:
- ✅ Moves directories safely and efficiently
- âš¡ Supports optional overwriting of existing directories
- 🧠Prevents recursive moves into self or subdirectories
- 🔄 Wraps I/O errors in detailed OpenLoomFileException
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidmoveInternal(Path source, Path target, boolean replaceExisting) Moves a directory from source to target.
-
Constructor Details
-
MoveDirectory
public MoveDirectory()
-
-
Method Details
-
moveInternal
Moves a directory from source to target.If
replaceExistingis true, an existing target directory will be replaced. Throws an exception if the target is inside the source directory to prevent recursion.- Parameters:
source- the source directory to movetarget- the target directory where the source will be movedreplaceExisting- whether to replace existing target directory- Throws:
OpenLoomFileException- if validation fails or an I/O error occurs
-