TransWikia.com

Solved-How to bulk rename IMG files in Windows

Super User Asked by empty_tables on December 5, 2020

I’m trying to organize my family’s media library, and I’m trying to take filenames such as IMG02003932(234212345) and get it just down to the numbers in the middle.

I think what I am ideally looking for is the ability to mass remove everything before the first occurrence of a character (such as the leading 0 to delete IMG in the filename. I would like it to be flexible for video files that have more than just 3 leading characters to delete.

I’d also like it on the tail end of the filename to delete a certain character and everything following it, such as the ( and everything following it.

I’ve used prefix/suffix scripts before, but not sure how to modify something like this with Windows. I’ve been able to do it in Excel, but I am having trouble with the logic behind it to replicate it.

One Answer

This will work it's PowerShell. Change the Dir to the one you need to work in. To do it for video just change extension and what should be replaced

$images = Get-ChildItem c:temp  -Recurse | where {$_.Extension -eq '.jpg'} 

foreach($image in $images){

    $newnname = $image.name -replace "IMG",""
    Rename-Item -Path $image.fullname -NewName $newnname -Force

}

Answered by Luis Adames on December 5, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP