Comprehensive directory & file manager with backup/restore and FS tools for ESP32 running MicroPython
Project description
libraryManager
Comprehensive library manager for Python projects.
Supports directory backup & restore, and filesystem tools like create/remove folders, copy files/directories, list files, and get file names.
Installation
pip install libraryManager
Importing
from libraryManager import LibraryManager, BackupError, RestoreError
Initialize library manager for a target directory
lm = LibraryManager(target_dir="services", backup_root=".backup")
---------- Backup & Restore ----------
Check if backup exists
if lm.has_backup():
print("Backup is available")
Clear backup
lm.clear_backup()
Create a snapshot backup
try:
lm.backup()
except BackupError as e:
print("Backup failed:", e)
Restore from backup
try:
lm.restore()
except RestoreError as e:
print("Restore failed:", e)
---------- Filesystem Tools ----------
Make directory (including parents)
lm.make_dir("services/new_folder")
Remove directory recursively
lm.remove_dir("services/old_folder")
Copy single file to a directory
lm.copy_file_to("example.txt", "services/new_folder")
Copy entire directory
lm.copy_dir_to("services/source", "services/destination")
List files in a directory
files = lm.list_files("services")
print(files)
Get filename from path
filename = lm.get_filename("/home/user/file.txt")
print(filename) # "file.txt"
Get name without extension
name = lm.get_name("/home/user/file.txt")
print(name) # "file"
Exceptions
-
BackupError → Raised when backup fails
-
RestoreError → Raised when restore fails
-
LibraryManagerError → Base exception for library manager
Documentation Summary
| Method | Description |
|---|---|
__init__(target_dir, root="/", backup_root=".backup") |
Initialize LibraryManager |
has_backup() |
Returns True if backup exists |
clear_backup() |
Clears backup directory |
backup() |
Create snapshot backup |
restore() |
Restore snapshot |
make_dir(path) |
Create folder recursively |
remove_dir(path) |
Remove folder recursively |
copy_file_to(src, dst) |
Copy file to destination folder |
copy_dir_to(src, dst) |
Copy folder recursively |
list_files(path) |
List files in folder |
get_filename(path) |
Get file name from path |
get_name(path) |
Get file/folder name without extension |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file esp32_librarymanager-1.0.0.tar.gz.
File metadata
- Download URL: esp32_librarymanager-1.0.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd35b76d0bda10be05d57b070211490b3b25fda8c5b4cd82f239930c68cc0e44
|
|
| MD5 |
8a325f77b12c45487cd53439790ff7c3
|
|
| BLAKE2b-256 |
08e5b6870f5cccf53b2f259512660df0e3e83fe212f8d0532225031975fdada0
|
File details
Details for the file esp32_librarymanager-1.0.0-py3-none-any.whl.
File metadata
- Download URL: esp32_librarymanager-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6411aa9600a85d629d67dfde2ab2bf07a11b82c8a4419813a86593703f30ba0b
|
|
| MD5 |
5141501872a195f1736c888167be0bae
|
|
| BLAKE2b-256 |
7b22bc883ef925466f9586daf4890c5fdd663fec13fe3c175ba6262967c2febc
|