File Utils module
A collection of utility functions for file management and data integrity.
Functions: - calculate_md5(file_path): Calculate the MD5 hash of a file specified by its path. - check_indir_status(indir=None): Check the status of a directory, providing information on its existence and contents. - check_infile_status(infile, extension=None): Check the status of a file, including its existence and optionally validate its extension. - get_file_creation_date(file_path): Retrieve the creation date of a file specified by its path.
Use these functions to enhance file handling and data validation in your Python projects.
calculate_md5(file_path)
Calculate the md5 checksum for the specified file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
the file for which the md5 checksum will be calculated |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the calculated md5 checksum |
Source code in jira_python_utils/file_utils.py
check_indir_status(indir=None)
Check if the directory exists and is a regular directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indir |
str
|
the directory to be checked |
None
|
Source code in jira_python_utils/file_utils.py
check_infile_status(infile, extension=None)
Check if the file exists, if it is a regular file and whether it has content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
infile |
str
|
the file to be checked |
required |
Source code in jira_python_utils/file_utils.py
get_file_creation_date(file_path)
Determine the creation date for the specified file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
the absolute path of the file |
required |
Returns:
Name | Type | Description |
---|---|---|
datetime |
datetime
|
the date the file was created according to the operating system |