Directory summary tool.
Project description
Summarization
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.
Installation
Install the current PyPI release:
pip install dirstuff
Usage
# Run the tree command to summarize a directory
$ dirstuff tree <root-dir>
# Specify the minimum file size (default is 10MB)
$ dirstuff tree <root-dir> --size 750MB
$ dirstuff tree <root-dir> --size 50KB
# Print full absolute paths to directories instead of directory names
$ dirstuff tree <root-dir> --absolute
# Run the list command to find all directories with a matching name
$ dirstuff list <root-dir> <dir-name>
# Specify the minimum file size (default is 10MB)
$ dirstuff list <root-dir> <dir-name> --size 750MB
$ dirstuff list <root-dir> <dir-name> --size 50KB
from dirstuff.os import Path
Examples
Tree
# 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
List
# List all node_modules folders under the /home/user/my_code directory
$ dirstuff list ~/Documents/Code/Projects/Current node_modules
|-> 419.6 MB > /user/my_code/portfolio/web/node_modules
|-> 320.3 MB > /user/my_code/fun_project/node_modules
|-> 298.1 MB > /user/my_code/simple_game/version_2/node_modules
Path utilities
dirstuff provides some Python utilities for interacting with the filesystem.
- rename
- move
- copy
- delete
- walk
In this example we iterate over nested folders that contain .txt files and rename them to have .md extensions.
from dirstuff.os 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")
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
dirstuff-0.1.3.tar.gz
(10.7 kB
view details)
Built Distribution
dirstuff-0.1.3-py3-none-any.whl
(11.0 kB
view details)
File details
Details for the file dirstuff-0.1.3.tar.gz
.
File metadata
- Download URL: dirstuff-0.1.3.tar.gz
- Upload date:
- Size: 10.7 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 | ce9ddc45970d4a5942d483f6dbda19024c838cf9568595a69c39753446ac83cc |
|
MD5 | 91fc24a1aca7d1f7a417b439d8c728ed |
|
BLAKE2b-256 | 47378870285e1f417f770cc7bf086a73524d683ee4186136c12ed354f7df51d8 |
File details
Details for the file dirstuff-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: dirstuff-0.1.3-py3-none-any.whl
- Upload date:
- Size: 11.0 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 | c6a6c80e50444953f403822006bfa2149f3a2d5cbab4e47b7b5665d6c1eeb3bf |
|
MD5 | 767b0c5e1a4b527aa28b0e0d1c18fe18 |
|
BLAKE2b-256 | dd07c393af8f94d06263471fb6de032045665bdd027746b2a6f4ed99c55897c7 |