Directory summary tool.
Project description
Installation
Install the current PyPI release:
pip install dirstuff
Path utilities
dirstuff provides some Python utilities for interacting with the filesystem.
- rename
- move
- copy
- delete
- walk
Rename files with a regex
In this example we iterate over nested folders that contain .txt files and rename them to have .md extensions.
from dirstuff import Dir
d = Dir("my_folder")
for sub in d.iter_dirs():
for f in sub.iter_files():
f.rename_regex(r"([a-z]*)\.txt", r"\1.md")
Delete a folder
No need to switch between pathlib
and shutil
packages. All filesystem utilities are available on the Dir
class.
from dirstuff import Dir
d = Dir("my_folder")
d.delete()
Summarization
Tree
Summarize a directory recursively by file size. This tool can be used to quickly search a drive for large files taking up too much space.
# Summarize the /home/user/my_documents directory
# showing only directories greater than 20MB in size
$ dirstuff tree /home/user/my_documents --size 20MB
|-> 69.0 GB > my_documents
|-> 67.8 GB > movies
|-> 62.0 GB > from_the_internet
|-> 5.8 GB > home_movies
|-> 638.1 MB > photos
|-> 368.2 MB > rock_concert
|-> 251.6 MB > vacation_2019
|-> 18.4 MB > family_photos
|-> 521.6 MB > work
|-> 263.8 MB > boring_docs
|-> 257.7 MB > reports
|-> 22.5 MB > games
You can show the full absolute paths with
--absolute
Search
Search for all folders with a matching name.
# List all node_modules folders under the /code/projects directory
$ dirstuff search /code/projects node_modules --absolute
|-> 419.6 MB > /code/projects/portfolio/web/node_modules
|-> 320.3 MB > /code/projects/fun_project/node_modules
|-> 298.1 MB > /code/projects/simple_game/version_2/node_modules
The same
--size
option also works with the search command
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
Built Distribution
File details
Details for the file dirstuff-0.2.0.tar.gz
.
File metadata
- Download URL: dirstuff-0.2.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.9.12 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f989cbfe02c3909fd75cb66078bd0f0a96dd2d9e60461aab72d00398b175898b |
|
MD5 | eb4d2cf27e7b3b8fc3442269c85a3e70 |
|
BLAKE2b-256 | 32d3fc1f3ee37cd39bcba8f074a001d5f098600b13022be81422681b8c9047eb |
File details
Details for the file dirstuff-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: dirstuff-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.9.12 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e22fdded7909e67475c5044394b4cc382a625085b758f59de3faaf62f2b1d74c |
|
MD5 | 914bf43aa5ab385cff02cc6f46c7ad72 |
|
BLAKE2b-256 | e8b1f1e27377808410ce5c9d5d29371f47211dba38c71e5c3664ba1e4a1f33c8 |