Skip to main content
Version: 0.1.x

remove_temp_dir

FunctionPrivateSource

remove_temp_dir(path: str | os.PathLike)

Remove the temporary directory.

Note that this method only works if it is called by the main process.

The exception caused by file occupation is suppressed.

Arguments​

Requires​

ArgumentTypeRequired
Description
pathstr | os.PathLikeThe path of the directory to be removed.

Examples​

Remove a folder​

import os
import multiprocessing as mproc
from dash_file_cache.utilities import remove_temp_dir

os.makedirs("temp-folder1", exists_ok=True)
os.makedirs("temp-folder2", exists_ok=True)

remove_temp_dir("temp-folder1")
p = mproc.Process(target=remove_temp_dir, args=("temp_folder2",))
p.start()
p.join()