File Renamer is a Go-based command-line tool that renames files in a specified directory according to a predefined pattern. It's designed to organize files by adding a sequence number and formatting the filename.
- Renames files in a specified directory
- Adds sequence numbers to filenames (e.g., "1 of 5")
- Supports dry run mode to preview changes
- Handles file extensions correctly
-
Ensure you have Go installed on your system. If not, download and install it from golang.org.
-
Clone the repository:
git clone https://github.com/yourusername/file-renamer.git cd file-renamer -
Build the project:
go build
Run the tool with the following command:
./file-renamer [flags]-dry: Run in dry mode (default: true). Set to false to actually rename files.
To preview changes without renaming files:
./file-renamerTo rename files:
./file-renamer -dry=false- The tool walks through the "sample" directory.
- It identifies files matching the pattern:
base_number.extension. - Files are grouped by their base name and extension.
- Each group is renamed to:
Base - X of Y.extension, where X is the sequence number and Y is the total count of files in the group.
- The tool currently processes files in the "sample" directory relative to where the program is run.
- Ensure you have necessary permissions to rename files in the target directory.
- Always run in dry mode first to preview changes before actual renaming.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.