Filesystempro

Latest version: v2.0.0.0

Safety actively analyzes 682387 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

2.0.0.0

FileSystemPro 2.0 introduces a range of new features and enhancements to help you manage and monitor your system's devices more efficiently. With the integration of the psutil library, the new Device module offers comprehensive functionality for interacting with storage devices and monitoring CPU performance. Additionally, the new Compression module provides powerful tools for creating, extracting, and reading compressed archive files in tar and zip formats.

Device Module

python
from filesystem import device


The Device module includes powerful tools for managing and retrieving detailed information about your system's disks and CPU.

Disks

python
from filesystem.device import disks


The Disks part of the Device module provides functionalities for retrieving various disk-related information and metrics, such as disk partitions, boot drive names, filesystem types, and storage metrics. It also includes filtering capabilities to narrow down the information based on specific criteria.

- **Current Disk Filesystem Name:** Returns the name of the current disk filesystem.
- **Boot Time:** Provides the system's boot time.
- **Disk Partitions:** Retrieves disk partitions.
- **Boot Drive Name:** Returns the name of the boot drive.
- **Filter by Device:** Filters disk partitions based on the device.
- **Filter by Filesystem Type:** Filters disk partitions based on filesystem type.
- **Filter by Mount Point:** Filters disk partitions based on the mount point.
- **Filter by Options:** Filters disk partitions based on options.
- **Storage Metrics:** Provides storage metrics for a specific mount point.
- **Disk Info:** Displays detailed information about the disks.
- **Disk I/O Counters:** Returns disk I/O counters.

CPU

python
from filesystem.device import cpu


The CPU part of the Device module provides functionalities for retrieving various CPU-related information, such as CPU usage percentage, CPU times, and the number of CPU cores. It offers essential metrics for monitoring CPU performance.

- **CPU Usage Percentage:** Returns the CPU usage percentage.
- **CPU Usage Times:** Provides CPU usage times.
- **CPU Count:** Returns the number of CPUs (logical cores) available in the system.

These new features empower developers with enhanced tools to efficiently manage and monitor storage devices and CPU performance.

Compression Module (79)

python
from filesystem import compression


The Compression module is responsible for creating, extracting, and reading compressed archive files in tar and zip formats. It leverages Python's built-in tarfile and zipfile modules to handle these operations efficiently.

Tarfile (78)

- **Create Tar Archive:** Compresses a single file, directory, or a list of files/directories into a tar archive.
- **Extract Tar Archive:** Extracts files from a tar archive to a specified destination. It can extract all files or a specified list of files.
- **Read Tar Archive:** Reads and lists the contents of a tar archive.

Zipfile

- **Create Zip Archive:** Compresses a single file, directory, or a list of files/directories into a zip archive.
- **Extract Zip Archive:** Extracts files from a zip archive to a specified destination. It can extract all files or a specified list of files. (74)
- **Read Zip Archive:** Reads and lists the contents of a zip archive.

Directory Module

python
from filesystem import directory


The Directory library has received an update with the addition of the `get_size` function and a change in the logic of the `get_directories` function.

- **Get Size:** Calculates the total size of all files in the specified directory, returned in bytes, KB, MB, GB, or TB. (82)
- **Get Directories:** Lists all directories in a specified path, with the fullpath parameter defaulting to True.

File Module

python
from filesystem import file


This update introduces significant improvements to the File module.

- **Append Text:** Adds text directly to the file without automatically including a new line at the end. (77)
- **Create File:** Now includes an overwrite parameter for greater flexibility in handling file operations. (76)
- **Find Duplicates:** Moved from the Wrapper module to the File module.
- **Get Size:** Calculates the total size of all files in the specified directory, returned in bytes, KB, MB, GB, or TB. (81)

Wrapper Module

python
from filesystem import wrapper


In this new version, some functions from the Wrapper module have been relocated to other modules or have become obsolete to improve the organization and efficiency of the code. (80)

- **Combine Paths:** Now available in the Directory module.
- **Create Directory:** Now available in the Directory module.
- **Create File:** Now available in the File module.
- **Delete Path:** Now available in both the Directory and File modules.
- **Enumerate Files:** Now available in the File module.
- **Find Duplicates:** Now available in the File module.
- **Get Files:** Now available in the File module.
- **Get Size:** Now available in both the Directory and File modules.
- **Join Paths:** Now available in the Directory module.
- **List Directories:** Now available in the Directory module.
- **List Files:** Now available in the File module.
- **Make Zip:** Became obsolete. Use the Compression module.
- **Read Zip File Contents:** Became obsolete. Use the Compression module.

FileSystem Module

python
import filesystem as fs


FileSystemPro 2.0 introduces significant changes for managing file paths on Windows, ensuring accurate and efficient path retrieval.

- **Registry-Based Path Retrieval:** The module now uses the `winreg` module to retrieve accurate paths from the Windows registry. (33)

Updated Paths

For Windows, the paths are now retrieved using the `winreg` module for better accuracy:

- **Desktop:** Retrieves the path to the current user's Desktop folder using the registry.
- **Documents:** Retrieves the path to the current user's Documents folder using the registry.
- **Downloads:** Retrieves the path to the current user's Downloads folder using the registry.
- **Music:** Retrieves the path to the current user's Music folder using the registry.
- **Pictures:** Retrieves the path to the current user's Pictures folder using the registry.
- **Videos:** Retrieves the path to the current user's Videos folder using the registry.

Example Usage

The following example demonstrates how to access the Videos folder using the FileSystem library:

python
import filesystem as fs
print(fs.videos)


These changes were made to enhance the modularity and maintainability of the library. We appreciate your continued support and feedback, which are essential for these improvements.

1.0.4.0

We are thrilled to introduce the latest version of FileSystemPro, packed with new features and enhancements designed to improve your experience.

File

We are excited to introduce the latest update to our **File** module, designed to enhance your file management experience with improved functionality and performance. This module now includes several powerful functions designed to streamline your workflow and improve efficiency.

Added `append_text` function:

**Function Addition:** The `append_text` function was added to the **File** Module to handle appending text to files.
The function includes parameters for specifying the file path and the text to append.

**Error Handling:** Added error handling to manage cases where the file does not exist or cannot be accessed.

**Return Value:** The function now returns a boolean indicating the success or failure of the append operation.

Added `get_extension` function: (62)

**Function Addition:** The `get_extension` function was added to the **File** Module to handle extracting the file extension from a given file path. The function includes parameters for specifying the file path and whether the extension should be returned in lowercase or uppercase.

**Error Handling:** The function does not include explicit error handling, assuming the provided file path is valid.

**Return Value:** The function returns the file extension as a string, either in lowercase or uppercase based on the lower parameter.

> These updates enhance the function’s flexibility and ensure consistent handling of file extensions across different use cases

Changes in `create` function:

The default value of the encoding parameter has been changed from `utf-8-sig` to `utf-8`.
The `utf-8-sig` encoding includes a Byte Order Mark (BOM) at the beginning of the file, which can cause issues with some applications that do not expect it. The `utf-8` encoding does not include a BOM, making it more universally compatible.

> This update ensures better compatibility and avoids potential issues related to the BOM in UTF-8 encoded files.

Changes in `get_files` function: (71)

1. **Parameters Added:**
- **fullpath (bool):** A new parameter that, when set to `True`, returns the full path of each file. Defaults to False.
- **extension (str):** A new parameter that filters files by the specified extension. Defaults to `None`.
2. **Functionality Enhancements:**
- **Full Path Retrieval:** The function now has the capability to return the full path of files if `fullpath` is set to `True`.
- **Extension Filtering:** The function can now filter and return only files with the specified extension if the `extension` parameter is provided.
3. **Backward Compatibility:**
- The function maintains backward compatibility by defaulting the new parameters (`fullpath` and `extension`) to `False` and `None`, respectively, ensuring that existing code using the old function signature will still work without modification.

> These updates enhance the flexibility and functionality of the `get_files` function, making it more versatile for different use cases.

---

Directory

The Directory module has undergone several significant updates to enhance its functionality and usability. Here are the key changes:

Changes in `delete` function:

The recent change in the `delete` function of the **Directory** module includes a modification to the condition that checks if a directory exists. Previously, the function used `os.path.exists(path)` to check for the directory’s existence. This has been updated to use the `exists(path)` function instead.

> This change ensures that the custom `exists` function is used consistently throughout the module.

Changes in `exists` function:

The `exists` function has been simplified for better readability and efficiency. The `else` statement has been removed, as it is redundant. Now, if `os.path.isdir(path)` returns `True`, the function will return `True`. If not, it will directly return `False` without needing an `else` block.


Changes in `get_directories` function:

The `get_directories` function in the code has been updated to include an additional parameter `fullpath`.

- **New Parameter:** `fullpath` (default is False) When set to **True**, the function returns the full path of each directory.

- **Conditional Logic:** Added logic to append the full path of directories to the list if `fullpath` is **True**.

> These changes enhance the function’s flexibility by allowing it to return either directory names or full paths based on the `fullpath` parameter.

---

Wrapper

With this update, the **Wrapper** module now offers a more convenient method for handling ZIP files, enhancing its overall functionality and user experience.

Added `read_zip_file_contents` function: (65)

This function is designed to read the contents of a ZIP file.

The function aims to simplify the process of extracting and reading files within a ZIP archive, making it easier for users to handle ZIP files within the FileSystemPro library.

The new function takes a single parameter, `zip_filename`, which is the path to the ZIP file. It reads the contents of the ZIP file and returns them in a structured format.

Users can call this function to quickly access the contents of a ZIP file without manually handling the extraction process.

> These changes enhance the functionality of the **Wrapper** module by providing a convenient method for working with ZIP files.

---

Please take a moment to familiarize yourself with these changes.
Let's continue to work together to improve FileSystem Pro!

Bisneto.

1.0.3.0

New Features

Directory Module: (54)

A new module for directory operations has been introduced. The **Directory** module is a component of the FileSystemPro library that provides a collection of functions
for handling directory-related operations. It simplifies tasks such as path manipulation,
directory creation and deletion, and file retrieval within directories.

File Module

A new module dedicated to file operations has been added. The **File** module is a comprehensive utility toolset that forms part of the FileSystemPro library.
It provides a suite of functions designed to handle various file operations such as integrity checks,
file creation, deletion, enumeration, and file splitting and reassembling.


Enhancements

Several improvements were made to the FileSystemPro, particularly in the **Wrapper**, **Watcher**, and **Documentation**. Below are key enhancements:

- **Duplicate File Finder**: Within the Wrapper module, a function to find duplicate files has been implemented. (43)
- **Size Calculation**: A function to calculate the size of files or directories in various units has been added to the Wrapper module. (61)
- **Extension Check**: The Wrapper module now includes a function to check for file path extensions.
- **Project Description**: Updated the project description in the Setup.py file and the GitHub repository.
- **Documentation**: Enhanced code with comprehensive documentation
- **File Splitter/Joiner**: Introduced tools for splitting and joining files. (41)
- **Checksum Verification**: Added functionality for verifying file integrity through checksums. (36)
- **Binary File Creation**: Implemented a feature to create binary files. (18)

FileSystemPro have been updated with enhanced error handling mechanisms. This improvement significantly boosts the security and stability of filesystem operations, ensuring a smoother and safer user experience.

Changes
- **Platform Name**: Updated the platform name from Mac to macOS. (25)
- **Watcher Module Update**: Modified the Watcher module to import functions from the new File module.

Support
- **Wrapper Module**: Some functions in the Wrapper module are now under support. It is recommended to use the Directory and File Modules instead.

1.0.2.0

Improvements

- **Version Check**: Implemented a function to check for updates to the FileSystemPro library.
- **Update Notification**: Added a notification system to alert users of new releases.
- **Installation Instructions**: Provided clear instructions for updating the library using pip.

This update enhances the user experience by ensuring they are always working with the latest version of the library, with easy-to-follow steps for upgrading.

Console

Console is a robust library designed to enable ANSI escape character sequences, which are used for generating coloured terminal text and cursor positioning. This library is a key addition to FileSystemPro as a third-party library, enhancing the toolkit for developers who require consistent terminal styling across different operating systems.

python
from filesystem import console


- **ANSI Escape Sequences**: Integrated the open source library **Colorama** to enhance the Console with ANSI escape character sequences, enabling coloured terminal text and cursor positioning
- **Cross-Platform Compatibility**: Ensured that the new Console implementation works seamlessly across different platforms, including Windows, by utilizing Colorama's functionality to strip ANSI sequences and convert them into appropriate win32 calls.
- **Simplified API**: Provided a simple cross-platform API for printing coloured terminal text from Python, making it easier for developers to create visually appealing console output
- **Enhanced Output**: Improved the visual output of the Console by supporting various formatting constants like **foreground**, **background**, and **style**, allowing for a more customised and readable display.
- **Simplified Integration:** With no dependencies other than the standard library, integrating Console into your projects is straightforward. It’s tested across multiple Python versions, ensuring reliability.
- **Effortless Transition:** For developers transitioning to FileSystemPro, incorporating Console into your workflow is effortless, enabling you to maintain the visual aspects of your terminal applications without platform constraints.

This update brings a significant enhancement to the Console's capabilities, offering a more robust and user-friendly experience for FileSystemPro users.


Documentation (README)

- **Enhanced Documentation**: Introduced a **clear and structured table** that lists all methods with corresponding explanations, improving the readability and accessibility of the documentation.
- **Method Overview**: Provided a **concise summary** for each method, allowing users to quickly understand the purpose and usage of the FileSystemPro toolkit functions.
- **User-Friendly Format**: Adopted a **tabular format** to organize the method information, which enhances the user experience by making it easier to navigate through the documentation.
- **Improved Clarity**: The table format helps to **distinguish between different methods** and their descriptions, ensuring that users can find the information they need without confusion.

This update aims to make the FileSystemPro documentation more user-friendly and informative, aiding developers in utilising the toolkit more effectively.

Changes

Wrapper

- **wrapper.delete:** (`def delete(path, recursive=False):`)
- **Enhanced Error Handling:** Changed behavior for non-existent directory operations. The system now raises an Exception instead of printing an error message, providing a more robust error handling mechanism.
- **Strict Directory Deletion Policy:** Modified the response to attempts at deleting non-empty directories. The library will now raise an Exception to enforce the use of the recursive parameter when necessary, ensuring safer file operations.

---

Developer Notes

These updates require developers to handle exceptions in their code where FileSystemPro functions are utilized.
Ensure that proper try-except blocks are implemented to maintain the application’s stability.
Update any relevant documentation to guide users through the new error handling process.

---

Let's continue to work together to improve FileSystem Pro!

Bisneto.

1.0.1

FileSystem Pro 1.0.1 includes the following improvements:

- **Platform Import**: We have imported the `platform` from the `sys` module.

- **OS Separator**: We have defined `OS_SEPARATOR` as `os.sep`. This attribute in the `os` module represents the character used by the operating system to separate pathname components. This will help us create file paths in a cross-platform compatible way.

- **New Function - Combine**: A new function `combine(*args, paths=[])` has been added to the Wrapper. (19)
> Learn more about `combine` function by reading the [docs](https://github.com/hbisneto/FileSystemPro/blob/main/README.md)

- **New Function - Join**: A new function `join(path1='', path2='', path3='', path4='', paths=[])` has been added to the Wrapper. (19)
> Learn more about `join` function by reading the [docs](https://github.com/hbisneto/FileSystemPro/blob/main/README.md)

- **Update to Create File Function**: The `create_file(file_name, path, text, encoding="utf-8-sig")` function now creates a file in UTF-8 by default encode. (16)

- **Function Replacement**: The `get_path_properties(pathname)` function has been replaced by `get_object(path)`.

Please take a moment to familiarize yourself with these changes. Let's continue to work together to improve FileSystem Pro!

Bisneto.

1.0

Initial release

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.