DirWalk

Provides various ways of walking a directory tree

Created on Jun 9, 2011

exception cpip.util.DirWalk.ExceptionDirWalk

Exception class for this module.

class cpip.util.DirWalk.FileInOut

A pair of (in, out) file paths

filePathIn

Alias for field number 0

filePathOut

Alias for field number 1

cpip.util.DirWalk.dirWalk(theIn, theOut=None, theFnMatch=None, recursive=False, bigFirst=False)

Walks a directory tree generating file paths.

theIn - The input directory.

theOut - The output directory. If None then input file paths as strings will be generated If non-None this function will yield FileInOut(in, out) objects. 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.

cpip.util.DirWalk.genBigFirst(d)

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.

Previous topic

DictTree

Next topic

DupeLines

This Page