How to Clean Up Image Filenames with F2
Archiving your personal collection of family images can quickly become a mess without some sort of organizational approach. I think the first and most important aspect of any organization measures would be to clean up and standardize image file names. In my mind, this involves having a date indicator with year, month, and if at all possible, a day. This would look something like 2020-08-30_0124.jpg
. If you’re able to get this information into the file name most other methods of organization can easily follow but aren’t specifically required. For instance, folder structure for year and month would be helpful but not exactly required if you already that information written out in all your filenames.
But manually updating all filenames can be tedious and time consuming. Luckily, there is a wide selection of software that is capable of bulk file renaming for images. On Windows platforms I can recommend Bulk Rename Utility (BRU) and on MacOS, Name Mangler is equally as good. If you are comfortable on the command line and require something with a bit more raw power, there is F2.
I have just scratched the surface with F2 but it has capabilities far beyond my ultra simple image renaming jobs. It can read or write information based on directories, it is incredibly fast for large jobs, and integrates with many external utilities like ExifTool.
The assumption for everything after here is that you have F2 installed in addition to ExifTool. F2 will rely on ExifTool for the majority of the following commands.
Before starting, you should do some EXIF reconnaissance on your files. EXIF data (short for Exchangeable Image File Format) is like a digital notebook that accompanies an image file. When you take a picture with your phone or camera, it automatically records extra details about the photo, such as when and where it was taken, what camera settings were used, and even the type of camera or phone that captured it. This information is saved as part of the image file, but it isn’t visible in the photo itself, it’s behind the scenes. For our case, EXIF data can be helpful to easily extract the write data to rename our files appropriately. But it’s also something to be mindful of if you’re sharing pictures online, as it might include your location.
On modern smart devices there is a lot of information being coupled with image files. See the impressive number of fields from an image my wife took of my Speedgoat 50K race in 2024. It even includes the uptime of her phone.
exiftool 2024-07-20_0223.jpg
ExifTool Version Number : 13.06
File Name : 2024-07-20_0223.jpg
Directory : .
File Size : 4.4 MB
File Modification Date/Time : 2025:01:05 12:32:56-07:00
File Access Date/Time : 2025:01:17 14:52:08-07:00
File Inode Change Date/Time : 2025:01:05 13:46:55-07:00
File Permissions : -rw-r--r--
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
JFIF Version : 1.02
Exif Byte Order : Big-endian (Motorola, MM)
Make : Apple
Camera Model Name : iPhone 15 Pro Max
Orientation : Rotate 90 CW
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Software : 17.5.1
Modify Date : 2024:07:20 18:36:02
Host Computer : iPhone 15 Pro Max
Y Cb Cr Positioning : Centered
Exposure Time : 1/539
F Number : 1.8
Exposure Program : Program AE
ISO : 80
Exif Version : 0232
Date/Time Original : 2024:07:20 18:36:02
Create Date : 2024:07:20 18:36:02
Offset Time : -06:00
Offset Time Original : -06:00
Offset Time Digitized : -06:00
Components Configuration : Y, Cb, Cr, -
Shutter Speed Value : 1/539
Aperture Value : 1.8
Brightness Value : 6.75755074
Exposure Compensation : 0
Metering Mode : Multi-segment
Flash : Off, Did not fire
Focal Length : 6.8 mm
Subject Area : 2302 1876 484 488
Maker Note Version : 14
Run Time Flags : Valid
Run Time Value : 789101687277583
Run Time Scale : 1000000000
Run Time Epoch : 0
AE Stable : Yes
AE Target : 192
AE Average : 190
AF Stable : Yes
Acceleration Vector : -0.00598860486 -0.9743222594 -0.0465432033
Focus Distance Range : 1.37 - 1.39 m
Image Capture Type : Scene
Live Photo Video Index : 8595224612
Luminance Noise Amplitude : 0.01041153818
Photos App Feature Flags : 1
HDR Headroom : 0.9900000095
AF Performance : 113 1 33
Signal To Noise Ratio : 54.02030178
Photo Identifier : 1BB57D7A-74B0-4831-AB89-3320E711376B
Color Temperature : 5849
Camera Type : Back Normal
Focus Position : 67
HDR Gain : -0.04646149652
AF Measured Depth : 100
AF Confidence : 100
Semantic Style : {_0=1,_1=0,_2=0,_3=0}
Sub Sec Time Original : 742
Sub Sec Time Digitized : 742
Flashpix Version : 0100
Color Space : Uncalibrated
Exif Image Width : 5712
Exif Image Height : 4284
Sensing Method : One-chip color area
Scene Type : Directly photographed
Exposure Mode : Auto
White Balance : Auto
Focal Length In 35mm Format : 24 mm
Scene Capture Type : Standard
Lens Info : 2.220000029-15.65999985mm f/1.779999971-2.8
Lens Make : Apple
Lens Model : iPhone 15 Pro Max back triple camera 6.765mm f/1.78
Composite Image : General Composite Image
GPS Latitude Ref : North
GPS Longitude Ref : West
GPS Altitude Ref : Above Sea Level
GPS Time Stamp : 00:36:01
GPS Speed Ref : km/h
GPS Speed : 0.1803867135
GPS Img Direction Ref : True North
GPS Img Direction : 149.5131072
GPS Dest Bearing Ref : True North
GPS Dest Bearing : 149.5131072
GPS Date Stamp : 2024:07:21
GPS Horizontal Positioning Error: 4.775458293 m
Compression : JPEG (old-style)
Thumbnail Offset : 3028
Thumbnail Length : 10862
XMP Toolkit : XMP Core 6.0.0
Creator Tool : 17.5.1
Date Created : 2024:07:20 18:36:02
Region Area Y : 0.438, 0.4385
Region Area W : 0.086952380952380948, 0.084857142857142853
Region Area X : 0.41147619047619044, 0.40309523809523812
Region Area H : 0.11599999999999999, 0.11299999999999999
Region Area Unit : normalized, normalized
Region Type : Face, Focus
Region Extensions Angle Info Yaw: 356
Region Extensions Angle Info Roll: 274
Region Extensions Confidence Level: 669
Region Extensions Face ID : 488
Region Extensions :
Region Applied To Dimensions H : 4284
Region Applied To Dimensions W : 5712
Region Applied To Dimensions Unit: pixel
Profile CMM Type : Apple Computer Inc.
Profile Version : 4.0.0
Profile Class : Display Device Profile
Color Space Data : RGB
Profile Connection Space : XYZ
Profile Date Time : 2022:01:01 00:00:00
Profile File Signature : acsp
Primary Platform : Apple Computer Inc.
CMM Flags : Not Embedded, Independent
Device Manufacturer : Apple Computer Inc.
Device Model :
Device Attributes : Reflective, Glossy, Positive, Color
Rendering Intent : Perceptual
Connection Space Illuminant : 0.9642 1 0.82491
Profile Creator : Apple Computer Inc.
Profile ID : ecfda38e388547c36db4bd4f7ada182f
Profile Description : Display P3
Profile Copyright : Copyright Apple Inc., 2022
Media White Point : 0.96419 1 0.82489
Red Matrix Column : 0.51512 0.2412 -0.00105
Green Matrix Column : 0.29198 0.69225 0.04189
Blue Matrix Column : 0.1571 0.06657 0.78407
Red Tone Reproduction Curve : (Binary data 32 bytes, use -b option to extract)
Chromatic Adaptation : 1.04788 0.02292 -0.0502 0.02959 0.99048 -0.01706 -0.00923 0.01508 0.75168
Blue Tone Reproduction Curve : (Binary data 32 bytes, use -b option to extract)
Green Tone Reproduction Curve : (Binary data 32 bytes, use -b option to extract)
HDR Gain Curve : (Binary data 2067 bytes, use -b option to extract)
Image Width : 5712
Image Height : 4284
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
Run Time Since Power Up : 9 days 3:11:42
Aperture : 1.8
Image Size : 5712x4284
Megapixels : 24.5
Scale Factor To 35 mm Equivalent: 3.5
Shutter Speed : 1/539
Create Date : 2024:07:20 18:36:02.742-06:00
Date/Time Original : 2024:07:20 18:36:02.742-06:00
Modify Date : 2024:07:20 18:36:02-06:00
Thumbnail Image : (Binary data 10862 bytes, use -b option to extract)
GPS Altitude : 2471.3 m Above Sea Level
GPS Date/Time : 2024:07:21 00:36:01Z
GPS Latitude : 40 deg 34' 51.92" N
GPS Longitude : 111 deg 39' 24.29" W
Circle Of Confusion : 0.008 mm
Field Of View : 73.7 deg
Focal Length : 6.8 mm (35 mm equivalent: 24.0 mm)
GPS Position : 40 deg 34' 51.92" N, 111 deg 39' 24.29" W
Hyperfocal Distance : 3.04 m
Light Value : 11.1
Lens ID : iPhone 15 Pro Max back triple camera 6.765mm f/1.78
Certainly overwhelming, but we are only interested in 3 fields that have date information. If present, these fields will be essential in rewriting the file name.
Date/Time Original
Create Date
Modify Date
If those fields aren’t present or maybe 1 is missing there is still hope. I have noticed that over the years that image taking devices such as iPhones and normal cameras will add in some of those date fields and leave the others blank. I also noticed in iOS movie files that DateTimeOriginal
was more often present than Create Date
. Or it might be the churn of files going across systems and platforms that things start to go missing in the EXIF fields. But you need to be aware of what is actually present.
Say you’ve read through your files and most have the CreateDate
field present with an accurate date. The below command would instruct F2 to read the field CreateDate
with the help of ExifTool and output the formatted date followed by a four digit sequencing value before the file extension. The -R
flag asks F2 to look recursively if there are files farther down from where you command line is currently running.
f2 -r '{xt.CreateDate}_{%04d}{ext}' -R --exiftool-opts '--dateFormat %Y-%m-%d'
*—————————————————————*—————————————————————*————————*
| ORIGINAL | RENAMED | STATUS |
*—————————————————————*—————————————————————*————————*
| IMG_4282.jpg | 2020-08-30_0124.jpg | ok |
| IMG_4283.jpg | 2020-08-30_0125.jpg | ok |
| IMG_4284.jpg | 2020-08-30_0126.jpg | ok |
*—————————————————————*—————————————————————*————————*
dry run: commit the above changes with the -x/--exec flag
A preview output is given before any changes are actually made, which is very helpful. If a file does not have information from CreateDate
then the date portion of the new filename would be blank. To run the command you do it again but adding a -x
flag at the end.
For files that don’t have CreateDate
field you could use DateTimeOriginal
instead. I found that this was the situation a lot for iOS .mov
files.
f2 -r '{xt.DateTimeOriginal}_{%04d}{ext}' -R --exiftool-opts '--dateFormat %Y-%m-%d'
*—————————————————————*—————————————————————*————————*
| ORIGINAL | RENAMED | STATUS |
*—————————————————————*—————————————————————*————————*
| IMG_4282.jpg | 2020-08-30_0124.jpg | ok |
| IMG_4283.jpg | 2020-08-30_0125.jpg | ok |
| IMG_4284.jpg | 2020-08-30_0126.jpg | ok |
*—————————————————————*—————————————————————*————————*
dry run: commit the above changes with the -x/--exec flag
For those as obsessive compulsive as myself there are additional steps to clean up filenames. One approach is to remove the uppercase file extensions placed on some files. It is my personal opinion that all file extensions should be lower case. Many filesystems are case sensitive so you are just making it easier for yourself and others in the future. Additionally, consolidating common extensions like .jpeg
into simply .jpg
could also prove helpful in fortifying your future sanity.
The below command changes files with .jpeg
extensions to .jpg
. It ignore case, which would match something like .JPEG
. It will perform recursively into subfolders.
f2 -f 'jpeg' -r 'jpg' -i -R
*——————————————————*—————————————————*————————*
| ORIGINAL | RENAMED | STATUS |
*——————————————————*—————————————————*————————*
| IMG_0297.jpeg | IMG_0297.jpg | ok |
| IMG_0298.jpeg | IMG_0298.jpg | ok |
| IMG_0299.jpeg | IMG_0299.jpg | ok |
*——————————————————*—————————————————*————————*
dry run: commit the above changes with the -x/--exec flag
The below command changes files with .JPG
extensions to .jpg
. It ignore case, which would match something like .JPEG
. It will perform recursively into subfolders.
f2 -f 'jpg' -r 'jpg' -i -R
*——————————————————*—————————————————*———————————*
| ORIGINAL | RENAMED | STATUS |
*——————————————————*—————————————————*———————————*
| IMG_3368.jpg | IMG_3368.jpg | unchanged |
| IMG_3369.JPG | IMG_3369.jpg | ok |
| IMG_3451.jpg | IMG_3451.jpg | unchanged |
| IMG_3455.JPG | IMG_3455.jpg | ok |
*——————————————————*—————————————————*————————*
dry run: commit the above changes with the -x/--exec flag
The below command changes files with .MOV
extensions to .mov
. It ignore case, which would match something like .MOV
. It will perform recursively into subfolders.
f2 -f 'mov' -r 'mov' -i -R
*—————————————————*—————————————————*————————*
| ORIGINAL | RENAMED | STATUS |
*—————————————————*—————————————————*————————*
| 10/IMG_4769.MOV | 10/IMG_4769.mov | ok |
| 12/IMG_5521.MOV | 12/IMG_5521.mov | ok |
| 12/IMG_5522.MOV | 12/IMG_5522.mov | ok |
*—————————————————*—————————————————*————————*
dry run: commit the above changes with the -x/--exec flag
Once you have your image filenames updated appropriately it will provide a good foundation to maintain your archive or pursue organization even further. Luckily, this semi-tedious job is often only required once in a file’s lifetime. That is if you have an appropriate number of backups and redundancy for your file storage.