TotalDepth.util.DirWalk (Directory Walking)

Provides various ways of walking a directory tree

Created on Jun 9, 2011

class TotalDepth.util.DirWalk.FileInOut(filePathIn, filePathOut)
filePathIn

Alias for field number 0

filePathOut

Alias for field number 1

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

static __new__(_cls, filePathIn: str, filePathOut: str)

Create new instance of FileInOut(filePathIn, filePathOut)

__repr__()

Return a nicely formatted representation string

exception TotalDepth.util.DirWalk.ExceptionDirWalk

Exception class for this module.

TotalDepth.util.DirWalk.gen_big_first(directory)

Generator that yields the biggest files (name not path) first. This is fairly simple in that it it only looks the current directory not only sub-directories. Useful for multiprocessing.

TotalDepth.util.DirWalk.dirWalk(theIn: str, theOut: str = '', theFnMatch: str = '', recursive: bool = False, bigFirst: bool = False) → Sequence[TotalDepth.util.DirWalk.FileInOut]

Walks a directory tree generating file paths as FileInOut(in, out) objects.

theIn - The input directory.

theOut - The output directory. If an empty string the out path will be an empty string. NOTE: This does not create the output directory structure, it is up to the caller to do that.

theFnMatch - A glob like match pattern for file names (not tested for directory names).

recursive - Boolean to recurse or not.

bigFirst - If True then the largest files in directory are given first. If False it is alphabetical.