rmpath(path=None, *args, die=True, verbose=True, interactive=False, **kwargs)[source]#

Remove file(s) and folder(s). Alias to os.remove() (for files) and shutil.rmtree() (for folders).

  • path (str/Path/list) – file, folder, or list to remove

  • args (list) – additional paths to remove

  • die (bool) – whether or not to raise an exception if cannot remove

  • verbose (bool) – how much detail to print

  • interactive (bool) – whether to confirm prior to each deletion

  • kwargs (dict) – passed to os.remove()/shutil.rmtree()


sc.rmpath('myobj.obj') # Remove a single file
sc.rmpath('myobj1.obj', 'myobj2.obj', 'myobj3.obj') # Remove multiple files
sc.rmpath(['myobj.obj', 'tests']) # Remove a file and a folder interactively
sc.rmpath(sc.getfilelist('tests/*.obj')) # Example of removing multiple files

New version 2.0.0.