Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ssokolow/trunc_filenames
Minimal recursive "truncate file/directory names to meet requirements" tool
https://github.com/ssokolow/trunc_filenames
quick-hack rust-lang utility
Last synced: about 8 hours ago
JSON representation
Minimal recursive "truncate file/directory names to meet requirements" tool
- Host: GitHub
- URL: https://github.com/ssokolow/trunc_filenames
- Owner: ssokolow
- License: mit
- Created: 2022-10-12T02:40:04.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-01T02:43:50.000Z (about 1 month ago)
- Last Synced: 2024-12-25T16:42:05.025Z (15 days ago)
- Topics: quick-hack, rust-lang, utility
- Language: Rust
- Homepage:
- Size: 50.8 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trunc_filenames
ssokolow@monolith ~ % trunc_filenames --help
trunc_filenames 0.1.0
Rename files and directories to fit length limits.WARNING: Will not preserve secondary extensions like .tar.gz
USAGE:
trunc_filenames [OPTIONS] [PATH]...ARGS:
... Paths to rename (recursively, if directories)OPTIONS:
-h, --help Print help information
--max-len Length to truncate to. (Default chosen for rclone name encryption)
[default: 140]
-n, --dry-run Don't actually rename files. Just print
-V, --version Print version information## Current shortcomings
1. Requires a POSIX platform because I didn't want to do something hacky and
then forget, so I only bothered to implement "the length we care about is the
_encoded_ length" based on `std::os::unix::ffi::OsStrExt`.
2. Doesn't preserve secondary extensions like the `.tar` in `.tar.gz`
3. If the file/directory name already contains bytes that aren't valid UTF-8, it
won't bother to ensure that the truncation falls on the boundary between
valid UTF-8 code points.All of these are because it was a quick itch-scratch I would normally write in
Python and not even revision-control or upload, it works well enough for the
problem it was meant to solve, and solving any of those would have a
significantly lower return on investment.