Home

Awesome

<p align="center"> <img src="https://ik.imagekit.io/turnupdev/f2_logo_02eDMiVt7.png" width="250" height="250" alt="f2"> </p> <p align="center"> <a href="http://makeapullrequest.com"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" alt=""></a> <a href="https://github.com/ayoisaiah/F2/actions"><img src="https://github.com/ayoisaiah/F2/actions/workflows/test.yml/badge.svg" alt="Github Actions"></a> <a href="https://golang.org"><img src="https://img.shields.io/badge/Made%20with-Go-1f425f.svg" alt="made-with-Go"></a> <a href="https://goreportcard.com/report/github.com/ayoisaiah/f2"><img src="https://goreportcard.com/badge/github.com/ayoisaiah/f2" alt="GoReportCard"></a> <a href="https://github.com/ayoisaiah/f2"><img src="https://img.shields.io/github/go-mod/go-version/ayoisaiah/f2.svg" alt="Go.mod version"></a> <a href="https://github.com/ayoisaiah/f2/blob/master/LICENCE"><img src="https://img.shields.io/github/license/ayoisaiah/f2.svg" alt="LICENCE"></a> <a href="https://github.com/ayoisaiah/f2/releases/"><img src="https://img.shields.io/github/release/ayoisaiah/f2.svg" alt="Latest release"></a> </p> <h1 align="center">F2 - Command-line batch renaming tool</h1>

F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely. Written in Go!

<img src="https://ik.imagekit.io/turnupdev/f2-demo_tnCZlpBrkhX.gif?tr:q-100" alt="F2 in action on Ubuntu Linux">

⚡ Installation

F2 is written in Go, so you can install it through go install (requires Go 1.19 or later):

go install github.com/ayoisaiah/f2/cmd/f2@latest

📦 NPM package

You can also install F2 via its npm package:

With npm:

npm i @ayoisaiah/f2 -g

With yarn:

yarn global add @ayoisaiah/f2

Other installation methods are available here.

💥 Why should you use F2?

✨ Main features

💻 Screenshots

Screenshot of F2 in action on Linux

F2 can utilise exif attributes from a variety of image formats

F2 can utilise ID3 attributes to organise music files

📃 Documentation

Visit the wiki page to view usage examples and learn about all the renaming operations that can be achieved with F2.

🔥 Benchmarks

Environment

Renaming 10,000 MP3 files using their ID3 attributes (~1.6 seconds):

hyperfine --warmup 3 'f2 -f ".*" -r "{{id3.artist}}_{{id3.album}}_{{id3.track}}_{{r} }.mp3" -x'
Benchmark #1: f2 -f ".*" -r "{{id3.artist}}_{{id3.album}}_{{id3.track}}_{{r}}.mp3" -x
  Time (mean ± σ):      1.691 s ±  0.031 s    [User: 1.326 s, System: 0.744 s]
  Range (min … max):    1.634 s …  1.736 s    10 runs

Renaming 100,000 files using a random string and an auto incrementing integer (~5 seconds):

hyperfine --warmup 3 'f2 -f ".*" -r "{{r}}_%03d" -x'
Benchmark #1: f2 -f ".*" -r "{{r}}_%03d" -x
  Time (mean ± σ):      4.938 s ±  0.328 s    [User: 2.792 s, System: 2.770 s]
  Range (min … max):    4.421 s …  5.474 s    10 runs

Renaming 100,000 JPEG files using their Exif attributes (~30 seconds):

hyperfine --warmup 3 'f2 -f ".*" -r "{{x.make}}_{{x.model}}_{{x.iso}}_{{x.wh}}_{{r}}_%03d.jpg" -x'
Benchmark #1: f2 -f ".*" -r "{{x.make}}_{{x.model}}_{{x.iso}}_{{x.wh}}_{{r}}_%03d.jpg" -x
  Time (mean ± σ):     31.143 s ±  1.691 s    [User: 34.792 s, System: 4.779 s]
  Range (min … max):   29.317 s … 33.355 s    10 runs

Windows

Renaming 10,000 MP3 files with an auto incrementing integer through native PowerShell commands (~30 seconds):

Measure-Command { Get-ChildItem *.mp3 | ForEach-Object -Begin { $count = 1 } -Process { Rename-Item $_ -NewName "music_$count.mp3"; $count++ } }
Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 29
Milliseconds      : 582
Ticks             : 295824810
TotalDays         : 0.000342389826388889
TotalHours        : 0.00821735583333333
TotalMinutes      : 0.49304135
TotalSeconds      : 29.582481
TotalMilliseconds : 29582.481

Renaming 10,000 MP3 files with an auto incrementing integer through F2 (~12 seconds):

Measure-Command { f2 -f ".*" -r "audio_%03d.mp3" -x }
Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 11
Milliseconds      : 634
Ticks             : 116342215
TotalDays         : 0.000134655341435185
TotalHours        : 0.00323172819444444
TotalMinutes      : 0.193903691666667
TotalSeconds      : 11.6342215
TotalMilliseconds : 11634.2215

🤝 Contribute

Bug reports and feature requests are much welcome! Please open an issue before creating a pull request.

⚖ Licence

Created by Ayooluwa Isaiah and released under the terms of the MIT Licence.