nipoppy.utils.fileops¶
File operations utility functions.
Module Contents¶
- nipoppy.utils.fileops.copy(source, target, dry_run=False, exist_ok=False)¶
Copy a file or directory.
Raise an error by default if the target path already exists.
- Parameters:
source (pathlib.Path)
target (pathlib.Path)
exist_ok (bool)
- nipoppy.utils.fileops.copy_template(source, dest, *, substitutions, dry_run=False, exist_ok=False)¶
Copy a file with template substitution.
- Parameters:
source (pathlib.Path) – Source template file path
dest (pathlib.Path) – Destination file path
substitutions (dict) – Key-value pairs passed to process_template_str for substitution
dry_run (bool)
exist_ok (bool)
- nipoppy.utils.fileops.mkdir(dpath, dry_run=False)¶
Create a directory (including parents).
Do nothing if the directory already exists.
- Parameters:
dpath (pathlib.Path)
- nipoppy.utils.fileops.movetree(source, target, dry_run=False)¶
Move directory tree.
- Parameters:
source (pathlib.Path)
target (pathlib.Path)
- nipoppy.utils.fileops.rm(path, dry_run=False)¶
Remove a file, directory, or symlink.
- Parameters:
path (pathlib.Path)
- nipoppy.utils.fileops.symlink(source, target, force=False, dry_run=False)¶
Create a symlink: target (symlink) -> source.
- Parameters:
source (pathlib.Path)
target (pathlib.Path)
force (bool)
- nipoppy.utils.fileops.logger¶