datalad_next.shell.operations.posix.delete
- datalad_next.shell.operations.posix.delete(shell: ShellCommandExecutor, files: list[PurePosixPath], *, force: bool = False, check: bool = False) ExecutionResult [source]
Delete files on the connected shell
The requirements for delete are: - The connected shell must be a POSIX shell. -
rm
must be installed in the remote shell.- Parameters:
shell (ShellCommandExecutor) -- The shell from which a file should be downloaded.
files (list[PurePosixPath]) -- The "paths" of the files that should be deleted.
force (bool) -- If
True
, enforce removal, if possible. For example, the command could change the permissions of the files to be deleted to ensure their removal.check (bool, optional, default: False) -- If
True
, raise aCommandError
if the remote operation does not exit with a0
as return code.
- Raises:
CommandError: -- If the remote operation does not exit with a
0
as return code, andcheck
isTrue
, aCommandError
is raised. It will contain the exit code and the last (up tochunk_size
(defined by thechunk_size
keyword argument toshell()
)) bytes of stderr output.