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.