FileUtils#
This module provides utilities for file management used by various IO modules.
See also
- abspath(filename)[source]#
Returns the filename using the full path specification.
Arguments
- filenamestr
The file name.
Returns
- filenamestr
The full file name.
- copy_file(source, sink)[source]#
Copy a file.
Arguments
- sourcestr
Filename of the file to copy.
- sinkstr
File or directory name to copy the file to.
Returns
- sinkstr
The name of the copied file.
- create_directory(filename, split=True)[source]#
Creates the directory of the file name if it does not exists.
Arguments
- filenamestr
The name to create the directory from.
- splitbool
If True, split the filename first.
Returns
- directorystr
The directory name.
- delete_directory(filename, split=False)[source]#
Deletes a directory of the filename if it exists.
Arguments
- filenamestr
The name to create the directory from.
- splitbool
If True, split the filename first.
Returns
- directorystr
The directory name.
- file_extension(filename)[source]#
Returns the file extension of a file
Arguments
- filenamestr
The file name.
Returns
- extensionstr
The file extension or None if it does not exists.
- is_directory(dirname)[source]#
Checks if a directory exists.
Arguments
- dirnamestr
The directory name.
Returns
- is_directorybool
True if source is a real file.
- is_file(filename)[source]#
Checks if a file exists.
Arguments
- filenamestr
The file name to check if it exists.
Returns
- is_filebool
True if filename exists on disk and is not a directory.