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 a CommandError if the remote operation does not exit with a 0 as return code.

Raises:

CommandError: -- If the remote operation does not exit with a 0 as return code, and check is True, a CommandError is raised. It will contain the exit code and the last (up to chunk_size (defined by the chunk_size keyword argument to shell())) bytes of stderr output.