Remove IMG_ Prefix from Photo Names

My Android phone prepends every photo file with “IMG_”. After copying the files to my computer, I use this simple Windows command to remove the prefix on all files in the folder:

rename "IMG_*.jpg" "////*.jpg"

Credit: this SuperUser answer.

To remove “VID_” from mp4 files:

rename "VID_*.mp4" "////*.mp4"

Update June 18, 2022

After upgrading my NordPlus to Android 12, the file picture name format changed. (Why?) Pictures are now named IMGyyyymmddhhmmss.jpg, with no underscores. I assume videos follow a similar convention, though I haven’t checked. I like the underscore between that date and time. Trying to fix that in batch gets crazy, so I’m switching to PowerShell:

Get-ChildItem *.* | Rename-Item -NewName { $_.Name -replace '\D{3}(\d{8})(\d{6})\.(\D{3})', '$1_$2.$3' } -WhatIf

That one command should remove any three-character prefix, insert an underscore between the date and time, and preserve a three-character file extension. After confirming that it does what you want, remove the ! -WhatIf to get it to actually rename files!

3 thoughts on “Remove IMG_ Prefix from Photo Names

  1. Andy

    great.. what the #$%^ where would one type this to make it work..

  2. Mark Berry Post author

    @Andy, that goes on a Windows command line. If you’re not familiar or comfortable with using CMD, you might want to look for a program that can rename files.

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.