Scratch#

class pyedb.generic.filesystem.Scratch(local_path, permission=511, volatile=False)#

Class for managing a scratch directory.

Overview#

remove

Remove the scratch directory and its contents.

copyfile

Copy a file to the scratch directory.

copyfolder

Copy a folder to the scratch directory.

path

Get the path of the scratch directory.

is_empty

Check if the scratch directory is empty.

Import detail#

from pyedb.generic.filesystem import Scratch

Property detail#

property Scratch.path: str#

Get the path of the scratch directory.

property Scratch.is_empty: bool#

Check if the scratch directory is empty.

Method detail#

Scratch.__enter__() Scratch#
Scratch.__exit__(exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: types.TracebackType | None) None#
Scratch.remove() None#

Remove the scratch directory and its contents.

Scratch.copyfile(src_file: str, dst_filename: str | None = None) str#

Copy a file to the scratch directory.

Parameters:
src_filestr

Source file with fullpath.

dst_filenamestr, optional

Destination filename with the extension. The default is None, in which case the destination file is given the same name as the source file.

Returns:
dst_filestr

Full path and file name of the copied file.

Scratch.copyfolder(src_folder: str, destfolder: str | None = None) str#

Copy a folder to the scratch directory.

Parameters:
src_folderstr

Source folder with fullpath.

destfolderstr, optional

Destination folder. The default is None, in which case the destination folder is given the same name as the source folder.

Returns:
destfolderstr

Full path of the copied folder.