filecmp.dircmp

class filecmp.dircmp(a, b, ignore=None, hide=None) Construct a new directory comparison object, to compare the directories a and b. ignore is a list of names to ignore, and defaults to filecmp.DEFAULT_IGNORES. hide is a list of names to hide, and defaults to [os.curdir, os.pardir]. The dircmp class compares files by doing shallow comparisons as described for filecmp.cmp(). The dircmp class provides the following methods: report() Print (to sys.stdout) a comparison between a and b. rep

filecmp.DEFAULT_IGNORES

filecmp.DEFAULT_IGNORES New in version 3.4. List of directories ignored by dircmp by default.

filecmp.cmpfiles()

filecmp.cmpfiles(dir1, dir2, common, shallow=True) Compare the files in the two directories dir1 and dir2 whose names are given by common. Returns three lists of file names: match, mismatch, errors. match contains the list of files that match, mismatch contains the names of those that don’t, and errors lists the names of files which could not be compared. Files are listed in errors if they don’t exist in one of the directories, the user lacks permission to read them or if the comparison coul

filecmp.cmp()

filecmp.cmp(f1, f2, shallow=True) Compare the files named f1 and f2, returning True if they seem equal, False otherwise. If shallow is true, files with identical os.stat() signatures are taken to be equal. Otherwise, the contents of the files are compared. Note that no external programs are called from this function, giving it portability and efficiency. This function uses a cache for past comparisons and the results, with cache entries invalidated if the os.stat() information for the file c

filecmp.clear_cache()

filecmp.clear_cache() Clear the filecmp cache. This may be useful if a file is compared so quickly after it is modified that it is within the mtime resolution of the underlying filesystem. New in version 3.4.

File and Directory Access

The modules described in this chapter deal with disk files and directories. For example, there are modules for reading the properties of files, manipulating paths in a portable way, and creating temporary files. The full list of modules in this chapter is: 11.1. pathlib — Object-oriented filesystem paths11.1.1. Basic use 11.1.2. Pure paths11.1.2.1. General properties 11.1.2.2. Operators 11.1.2.3. Accessing individual parts 11.1.2.4. Methods and properties 11.1.3. Concrete paths11.1.3.1. Met

fcntl.lockf()

fcntl.lockf(fd, cmd, len=0, start=0, whence=0) This is essentially a wrapper around the fcntl() locking calls. fd is the file descriptor of the file to lock or unlock, and cmd is one of the following values: LOCK_UN – unlock LOCK_SH – acquire a shared lock LOCK_EX – acquire an exclusive lock When cmd is LOCK_SH or LOCK_EX, it can also be bitwise ORed with LOCK_NB to avoid blocking on lock acquisition. If LOCK_NB is used and the lock cannot be acquired, an OSError will be raised and the

fcntl.ioctl()

fcntl.ioctl(fd, request, arg=0, mutate_flag=True) This function is identical to the fcntl() function, except that the argument handling is even more complicated. The request parameter is limited to values that can fit in 32-bits. Additional constants of interest for use as the request argument can be found in the termios module, under the same names as used in the relevant C header files. The parameter arg can be one of an integer, an object supporting the read-only buffer interface (like by

fcntl.flock()

fcntl.flock(fd, operation) Perform the lock operation operation on file descriptor fd (file objects providing a fileno() method are accepted as well). See the Unix manual flock(2) for details. (On some systems, this function is emulated using fcntl().) If the flock() fails, an OSError exception is raised.

fcntl.fcntl()

fcntl.fcntl(fd, cmd, arg=0) Perform the operation cmd on file descriptor fd (file objects providing a fileno() method are accepted as well). The values used for cmd are operating system dependent, and are available as constants in the fcntl module, using the same names as used in the relevant C header files. The argument arg can either be an integer value, or a bytes object. With an integer value, the return value of this function is the integer return value of the C fcntl() call. When the a