https://github.com/nerd-bear/file-driller
File Renamer: A powerful CLI tool for batch renaming files. Currently supports mass renaming with custom prefixes and filters. Future updates will expand functionality, making it a versatile file management Swiss Army knife.
https://github.com/nerd-bear/file-driller
Last synced: 3 months ago
JSON representation
File Renamer: A powerful CLI tool for batch renaming files. Currently supports mass renaming with custom prefixes and filters. Future updates will expand functionality, making it a versatile file management Swiss Army knife.
- Host: GitHub
- URL: https://github.com/nerd-bear/file-driller
- Owner: nerd-bear
- License: mit
- Created: 2024-09-11T22:04:24.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-09-11T22:12:34.000Z (8 months ago)
- Last Synced: 2024-09-12T08:22:48.073Z (8 months ago)
- Language: C++
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# File Renamer
This C++ program provides a command-line utility for batch renaming files in a specified directory. It allows users to rename files with a custom prefix, separator, and optional extension filter.
## Features
- Mass rename files in a directory
- Custom prefix and separator for new filenames
- Optional file extension filter
- Preserves original file extensions
- Sorts files alphabetically before renaming
- Provides informative console output## Requirements
- C++17 compatible compiler
- Standard C++ libraries## Usage
### Compile the program
```bash
g++ -std=c++17 file_renamer.cpp -o file_renamer
```### Run the program
The program supports two commands: `massname` and `help`.
#### Mass Rename Files
```bash
./file_renamer massname [extension_filter]
```- ``: Path to the directory containing files to rename
- ``: Prefix for the new filenames
- ``: Separator between the prefix and file number
- `[extension_filter]`: (Optional) Filter files by extension (e.g., ".txt", ".jpg")Example:
```bash
./file_renamer massname ./my_photos vacation_ - .jpg
```
This will rename all .jpg files in the `./my_photos` directory to `vacation_1.jpg`, `vacation_2.jpg`, etc.#### Help
```bash
./file_renamer help
```
Displays usage information for the program.## How It Works
1. The program checks if the specified directory exists.
2. It collects all files in the directory, applying the extension filter if provided.
3. Files are sorted alphabetically.
4. Each file is renamed using the format: ``.
5. The program outputs the old and new filename for each renamed file.
6. If any errors occur during renaming, they are reported to the console.## Error Handling
- Invalid directory paths are detected and reported.
- File renaming errors are caught and displayed without halting the program.
- Incorrect usage of the program results in helpful error messages.## Limitations
- The program does not recursively rename files in subdirectories.
- It does not handle duplicate filenames that may result from the renaming process.## Contributing
Feel free to fork this project and submit pull requests with improvements or bug fixes.
## License
[Specify your chosen license here]