Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vvampirius/batch-file-rename
Simple command line tool for batch file renaming
https://github.com/vvampirius/batch-file-rename
cli command-line-tool file-renaming filerename
Last synced: 5 days ago
JSON representation
Simple command line tool for batch file renaming
- Host: GitHub
- URL: https://github.com/vvampirius/batch-file-rename
- Owner: vvampirius
- License: mit
- Created: 2023-12-16T13:28:47.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-17T10:53:13.000Z (about 1 year ago)
- Last Synced: 2024-06-21T04:50:50.360Z (6 months ago)
- Topics: cli, command-line-tool, file-renaming, filerename
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# batch-file-rename
It's just a simple command line tool for batch file renaming.
It uses:
- REGEXP to extract the desired name from file name
- Golang Template to compose target file nameYou can use the following variables in template:
- .FileName - source fil name
- .Name - REGEXP extracted name from file name
- .Index - input file index (integer; from 1)
- .ModTime - file modification time (time.Time)
- .Size - file size (integer)## Examples
```bash
% batch-file-rename -template '{{.Index}} - {{.FileName}}' First.txt Second.txt Third.txt
'First.txt' -> '1 - First.txt'
'Second.txt' -> '2 - Second.txt'
'Third.txt' -> '3 - Third.txt'```
```bash
% batch-file-rename -name "^.*-\s+(.*)\s+File.*" -template '{{printf "%02d" .Index}} - {{.Name}}.txt' "123 - First File.txt" "562 - Second File.txt"
'123 - First File.txt' -> '01 - First.txt'
'562 - Second File.txt' -> '02 - Second.txt'
```