os.scandir()

os.scandir(path='.') Return an iterator of DirEntry objects corresponding to the entries in the directory given by path. The entries are yielded in arbitrary order, and the special entries '.' and '..' are not included. Using scandir() instead of listdir() can significantly increase the performance of code that also needs file type or file attribute information, because DirEntry objects expose this information if the operating system provides it when scanning a directory. All DirEntry method

os.rmdir()

os.rmdir(path, *, dir_fd=None) Remove (delete) the directory path. Only works when the directory is empty, otherwise, OSError is raised. In order to remove whole directory trees, shutil.rmtree() can be used. This function can support paths relative to directory descriptors. New in version 3.3: The dir_fd parameter.

os.replace()

os.replace(src, dst, *, src_dir_fd=None, dst_dir_fd=None) Rename the file or directory src to dst. If dst is a directory, OSError will be raised. If dst exists and is a file, it will be replaced silently if the user has permission. The operation may fail if src and dst are on different filesystems. If successful, the renaming will be an atomic operation (this is a POSIX requirement). This function can support specifying src_dir_fd and/or dst_dir_fd to supply paths relative to directory descr

os.renames()

os.renames(old, new) Recursive directory or file renaming function. Works like rename(), except creation of any intermediate directories needed to make the new pathname good is attempted first. After the rename, directories corresponding to rightmost path segments of the old name will be pruned away using removedirs(). Note This function can fail with the new directory structure made if you lack permissions needed to remove the leaf directory or file.

os.rename()

os.rename(src, dst, *, src_dir_fd=None, dst_dir_fd=None) Rename the file or directory src to dst. If dst is a directory, OSError will be raised. On Unix, if dst exists and is a file, it will be replaced silently if the user has permission. The operation may fail on some Unix flavors if src and dst are on different filesystems. If successful, the renaming will be an atomic operation (this is a POSIX requirement). On Windows, if dst already exists, OSError will be raised even if it is a file.

os.removexattr()

os.removexattr(path, attribute, *, follow_symlinks=True) Removes the extended filesystem attribute attribute from path. attribute should be bytes or str. If it is a string, it is encoded with the filesystem encoding. This function can support specifying a file descriptor and not following symlinks.

os.removedirs()

os.removedirs(name) Remove directories recursively. Works like rmdir() except that, if the leaf directory is successfully removed, removedirs() tries to successively remove every parent directory mentioned in path until an error is raised (which is ignored, because it generally means that a parent directory is not empty). For example, os.removedirs('foo/bar/baz') will first remove the directory 'foo/bar/baz', and then remove 'foo/bar' and 'foo' if they are empty. Raises OSError if the leaf d

os.remove()

os.remove(path, *, dir_fd=None) Remove (delete) the file path. If path is a directory, OSError is raised. Use rmdir() to remove directories. This function can support paths relative to directory descriptors. On Windows, attempting to remove a file that is in use causes an exception to be raised; on Unix, the directory entry is removed but the storage allocated to the file is not made available until the original file is no longer in use. This function is semantically identical to unlink().

os.readv()

os.readv(fd, buffers) Read from a file descriptor fd into a number of mutable bytes-like objects buffers. readv() will transfer data into each buffer until it is full and then move on to the next buffer in the sequence to hold the rest of the data. readv() returns the total number of bytes read (which may be less than the total capacity of all the objects). Availability: Unix. New in version 3.3.

os.readlink()

os.readlink(path, *, dir_fd=None) Return a string representing the path to which the symbolic link points. The result may be either an absolute or relative pathname; if it is relative, it may be converted to an absolute pathname using os.path.join(os.path.dirname(path), result). If the path is a string object, the result will also be a string object, and the call may raise a UnicodeDecodeError. If the path is a bytes object, the result will be a bytes object. This function can also support p