✨ A fast and simple CLI tool to clean and rename file names — powered by Go.
nametidy is a fast and flexible command-line tool for cleaning and renaming file names. It supports operations such as filename cleanup, adding sequence numbers, and undoing changes — all with a simple and intuitive interface.
See nametidy in action:
You can use the following scripts to automate the installation of nametidy. These scripts will detect your system's architecture and download the appropriate binary.
-
Download the script (it will be saved as
install.shin your current directory):# Using curl: curl -LO https://raw.githubusercontent.com/mi8bi/nametidy/main/scripts/install.sh # Or using wget: # wget https://raw.githubusercontent.com/mi8bi/nametidy/main/scripts/install.sh
-
Make it executable:
chmod +x install.sh
-
Run the installer:
./install.sh
This script installs
nametidyto/usr/local/bin. It may requiresudoprivileges if your user doesn't have write access to this directory.
-
Download the script: You can download
install.cmddirectly from the repository (e.g., save it to yourDownloadsfolder): https://raw.githubusercontent.com/mi8bi/nametidy/main/scripts/install.cmd (Right-click the link and select "Save link as..." or "Save As...") -
Run the installer: Open Command Prompt (
cmd.exe). Navigate to the directory where you savedinstall.cmd(e.g.,Downloads) and run it:cd C:\Users\YourUser\Downloads install.cmdOr, if
install.cmdis in your current directory:install.cmd
This script installs
nametidy.exeto%USERPROFILE%\binand attempts to add this directory to your User PATH environment variable. PATH changes will apply to new Command Prompt sessions.
-
Download the script: You can download
install.ps1directly from the repository (e.g., save it to yourDownloadsfolder): https://raw.githubusercontent.com/mi8bi/nametidy/main/scripts/install.ps1 (Right-click the link and select "Save link as..." or "Save As...") -
Run the installer: Open PowerShell. Navigate to the directory where you saved
install.ps1(e.g.,Downloads). You may need to adjust your execution policy to run the script. Example:cd C:\Users\YourUser\Downloads # Then run one of the following:To run the script for the current session without changing global policy:
PowerShell -ExecutionPolicy Bypass -File .\install.ps1
Alternatively, from within that PowerShell prompt:
# Temporarily bypass execution policy for the current process Set-ExecutionPolicy Bypass -Scope Process -Force .\install.ps1
This script installs
nametidy.exeto$env:USERPROFILE\binand attempts to add this directory to your User PATH environment variable persistently. PATH changes will apply to new PowerShell sessions or after restarting Windows.
You can download prebuilt binaries from the GitHub Releases page:
- Go to the Releases page on GitHub.
- Find the latest release and download the binary file for your OS and architecture (e.g.,
nametidy_windows_amd64.zipornametidy_linux_amd64.tar.gz). - Extract the archive. For
.tar.gzfiles on Linux/macOS:Fortar -xzvf nametidy_VERSION_OS_ARCH.tar.gz
.zipfiles on Windows, you can use File Explorer's built-in "Extract All..." option. - Move the extracted
nametidy(ornametidy.exeon Windows) executable to a directory in your system's PATH.- For Linux/macOS, a common location is
/usr/local/bin/:sudo mv nametidy /usr/local/bin/
- For Windows, you might choose a directory like
%USERPROFILE%\bin\and ensure this directory is added to your PATH environment variable.
- For Linux/macOS, a common location is
- Run
nametidy --help(ornametidy.exe --helpon Windows) to verify the installation.
nametidy is written in Go. To install it locally:
- Make sure Go is installed: https://golang.org/dl/
- Clone the repository:
git clone https://github.com/mi8bi/nametidy.git- Build the project with Go:
cd nametidy
go buildOrganize and standardize file names in your target directory using intuitive subcommands.
Removes unwanted characters, converts spaces to underscores, and standardizes file names.
nametidy clean -p ./test_dirRenamed: ./test_dir/file (1).txt → ./test_dir/file_1.txt
Renamed: ./test_dir/hello world.txt → ./test_dir/hello_world.txt
History file path: ./test_dir/.nametidy_history
Restores the most recent file renaming performed by nametidy
nametidy undo -p ./test_dirRestored: ./test_dir/file_1.txt → ./test_dir/file (1).txt
Restored: ./test_dir/hello_world.txt → ./test_dir/hello world.txt
Displays changes without modifying any files.
nametidy clean -p ./test_dir -d[DRY-RUN] ./test_dir/file (1).txt → ./test_dir/file_1.txt
[DRY-RUN] ./test_dir/hello world.txt → ./test_dir/hello_world.txt
Enables detailed logs of the renaming process.
nametidy clean -p ./test_dir -v2025/03/30 17:39:08 [INFO] Starting file name cleanup...
Renamed: ./test_dir/file (1).txt → ./test_dir/file_1.txt
Renamed: ./test_dir/hello world.txt → ./test_dir/hello_world.txt
History file path: ./test_dir/.nametidy_history
2025/03/30 17:39:08 [INFO] File name cleanup completed.
Adds numerical prefixes to file names. Use -n to set digit length, and -H for hierarchical mode.
nametidy number -p ./test_dir -n 3Renamed: ./test_dir/image.png → ./test_dir/001_image.png
Renamed: ./test_dir/photo.jpg → ./test_dir/002_photo.jpg
nametidy number -p ./test_dir -n 3 -HRenamed: ./test_dir/folder1/doc.txt → ./test_dir/folder1/001_doc.txt
Renamed: ./test_dir/folder1/note.pdf → ./test_dir/folder1/002_note.pdf
Renamed: ./test_dir/folder2/image.png → ./test_dir/folder2/001_image.png
| Option / Command | Description |
|---|---|
clean |
Cleans up file names (e.g., removes symbols, replaces spaces). |
number |
Adds sequence numbers to file names. |
undo |
Reverts the most recent operation. |
-p <path> |
(Required) Target directory to process. |
-n <digits> |
Sets the number of digits for sequence numbers (e.g., -n 3 → 001, 002). |
-H |
Enables hierarchical numbering by folder. |
-d |
Dry run mode — preview changes without applying them. |
-v |
Verbose output — shows logs during execution. |
This project is licensed under the MIT License. For more details, see the LICENSE file.