Menu

LIB_FOPS

Benedict Jäggi

LIB_FOPS

Import from appdata/CodeLibs/LIB_FOPS.py.

This library is for file operations.

Needs pyudev and psutil.

getDirName(fileordirname)

Returns the directory path where fileordirname is in.
e.g. dir = getDirName("myfile.txt")

splitExtension(filename)

Returns the extension of filename.

getRemovableDirs()

Returns a list with all mounted removable devices (USB-Sticks, SD-Cards).

getFileList(directory, allowedFileEndings)

Returns a list with all files in directory which have one of the allowed file endings.
AllowedFileEndings is a list with all allowed file endings in lowercase, e.g. [".bmp", ".jpg", ".jpeg"]
If AllowedFileEndings is empty, it will return all files regardless of the file ending.
AllowedFileEndings is an empty list by default.

getDirList(directory, ignoreHiddenDirs)

Returns a list with all directories in directory. Not recursive, see below.
ignoreHiddenDirs is True by default.

getAllDirs(rootdir, ignoreHiddenDirs)

Returns a list with all directories in rootdir and its directories , recursively.

getAllFiles(rootdir, allowedFileEndings)

Returns a list with all files with the allowed file endings in rootdir and all of its sub directories.
AllowedFileEndings is a list with all allowed file endings in lowercase, e.g. [".bmp", ".jpg", ".jpeg"]
If AllowedFileEndings is empty, it will return all files regardless of the file ending.
AllowedFileEndings is an empty list by default.

join(path1, path2)

Adds path2 to path1 including the proper slash or something.

tryMounting(dev, mntpoint, retest=False)

Try to mount the device dev at mountpoint mntpoint.
Returns True if device was mounted, else False.

tryUnmounting(dev, mntpoint, retest=False)

Try to unmount device dev from mountpoint mntpoint.


Related

Wiki: Home

MongoDB Logo MongoDB