This is an automated archive made by the Lemmit Bot.
The original was posted on /r/opensource by /u/RusselsTeap0t on 2024-04-16 16:24:02.
It’s a very minimal program under 200 SLOC. It has no dependencies except Linux and Glibc.
Sanitization is done according to UNIX and URL standards:
- Nothing but lowercased alphanumeric English.
- Spaces, dots, and dashes --> underscores.
- No consecutive, trailing, leading underscores.
- Keep the extensions intact (if it’s a file, not a directory).
- You will have resulting names such as:
example_folder/spreadsheet_file.ods
Detailed justifications can be found on the repo.
On newer machines with a lot of threads, It can even rename more than a million entries in seconds. Most human sized filesystems will be renamed instantly (0.000s).
It has lots of safety features (skips dotfiles; skips system files and the files the user doesn’t own; can’t be run as root, can’t override files). So you can directly run this with sanitizefs /home
command to rename simply everything on your system.
It also has a dry running flag, so you can test things without actually renaming anything.
It doesn’t use mv
or any other external command so it can’t override anything. It uses the lower level renameat2()
function directly from the Linux kernel. So it can only rename; fast and safe.
It can be easily integrated into TUI File Managers such as Yazi, LF, Ranger, NNN, vifm for even more automated, easier usage.
Instant Filename Sanitizer: Threaded & Recursive & Lightweight