Skip to main content

MPRA - Multipurpose Resource Automation

Project description

MPRA (Multipurpose Resource Automation) 🚀

MPRA is a powerful multipurpose utility package designed to automate common file and directory management tasks. From organizing files by extensions to checking disk space and monitoring directories for changes, MPRA provides an efficient and user-friendly solution to streamline your workflow.


Why MPRA? 🤔

MPRA is designed to be an all-in-one toolkit to simplify everyday system tasks. Whether you’re managing files, running system commands, or filtering directories, MPRA provides a lightweight yet effective solution to cover your automation needs.

  • Efficiency: Speed up your tasks with automated processes.
  • 📁 Organization: Keep your directories clean and well-organized.
  • 🔧 Customizable: Perform operations tailored to your specific requirements.
  • 📊 System Monitoring: Easily monitor system resources and directories.

Installation 💻

Ready to give it a go? Just run the following command to install MPRA:

pip install mpra

Usage 🔧

Here’s how you can integrate MPRA functions into your daily tasks.


from mpra import mpra

# Example usage
mpra.disk_stats("/path/to/directory")
mpra.file_organizer("/path/to/your/files")

Features 🛠️

Disk Usage Checker

Function: disk_stats(directory_path)
Description: This function takes a directory path as input and returns the total, used, and free disk space in gigabytes.

Parameters:

  • directory_path (str): The path of the directory to check.

Returns:

  • Total disk space, used space, and free space in gigabytes.

Example:

mpra.disk_stats('/path/to/directory')

File Organizer

Function: organize_files(directory_path)
Description: This function organizes files in the specified directory into subdirectories based on file extensions.

Parameters:

  • directory_path (str): The path of the directory to organize.

Example:

mpra.organize_files('/path/to/directory')

Directory Monitor

Function: monitor_directory(directory_path)
Description: This function monitors a directory for new files and prints a message each time a new file is added.

Parameters:

  • directory_path (str): The directory to monitor.

Example:

mpra.monitor_directory('/path/to/directory')

File Backup

Function: backup_files(source_directory, destination_directory)
Description: This function copies all files from the source directory to the destination directory.

Parameters:

  • source_directory (str): The path of the directory to copy files from.
  • destination_directory (str): The path of the directory to copy files to.

Example:

mpra.backup_files('/source/directory', '/destination/directory')

Batch Rename Files

Function: batch_rename(directory_path, prefix=None, suffix=None)
Description: This function renames all files in a directory by adding a prefix or suffix.

Parameters:

  • directory_path (str): The path of the directory containing the files.
  • prefix (str, optional): The prefix to add to each file name.
  • suffix (str, optional): The suffix to add to each file name.

Example:

mpra.batch_rename('/path/to/directory', prefix='backup_')

System Command Runner

Function: run_command(command)
Description: This function takes a system command as input and executes it. It returns the command's output.

Parameters:

  • command (str): The system command to execute.

Example:

mpra.run_command('ls -la')

Delete Empty Directories

Function: delete_empty_dirs(directory_path)
Description: This function recursively searches through a directory and deletes all empty subdirectories.

Parameters:

  • directory_path (str): The directory to clean up.

Example:

mpra.delete_empty_dirs('/path/to/directory')

File Size Filter

Function: filter_files_by_size(directory_path, min_size_bytes)
Description: This function lists all files in a directory that are larger than a specified size.

Parameters:

  • directory_path (str): The path of the directory to search.
  • min_size_bytes (int): The minimum file size (in bytes) to filter.

Example:

mpra.filter_files_by_size('/path/to/directory', min_size_bytes=1000000)

Log File Creator

Function: create_log(directory_path)
Description: This function generates a log file in the specified directory, logging the current date and time each time the script runs.

Parameters:

  • directory_path (str): The directory where the log file will be created.

Example:

mpra.create_log('/path/to/directory')

Feedback, Bugs, & Contributions 🐛

Got feedback or found a bug? Feel free to open an issue or contribute on GitHub:


License

Refer to the LICENSE file for details.

© 2024 MPRA Documentation. All rights reserved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpra-0.1.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mpra-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file mpra-0.1.1.tar.gz.

File metadata

  • Download URL: mpra-0.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mpra-0.1.1.tar.gz
Algorithm Hash digest
SHA256 24d16e0a7e3d3c4320a998044e52cb1208fc9beca0a823c2d2785ea0c1b1b9dc
MD5 8a3a6192082089a039663cd4d683b395
BLAKE2b-256 cce00499f3d62a1c59d7fd59b8b211f78d768dee9067b97c3cf7627fcace8ae2

See more details on using hashes here.

File details

Details for the file mpra-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mpra-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mpra-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3d8b545619180749070d0f66abdd0587ec3642732d9af708af82846cf2ac9e60
MD5 526448fd60d556a12f61f65081dc7094
BLAKE2b-256 3812b05ef9634ab527842094779f31f837e79f4c578cd153bd735dec7fc8d3e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page