Find & Rename Files w Same Names

Started by MikeInThe901, September 03, 2023, 06:21:40 AM

Previous topic - Next topic

MikeInThe901

I have lots of folders representing months and years that containing photos. In some of those folders there are multiple different sets of images that may have been on different SD cards when they were taken, but then they got combined together later. So I ended up with photos with replicated file names similar to below. All of the files with no suffix are from one set. All the files with a "-Copy" suffix are from a diff set. All of the files with a "-Copy2" suffix are from another set.

How can I use WinBatch to scan a set of folders, then in each folder rename the "-Copy" files collectively, and to rename the "-Copy2" files collectively, etc., to another naming scheme to make file management simpler. For example, if I rename "Image-001-Copy" to "Picture-001" and "Image-002-Copy" to "Picture-002", then when I manage the pics listed alphabetically they will be grouped correctly by which set they are from, thus easier to organize as a group. Does that make sense?

Oh and they are not all named "Image". They have various diff main filename stems. Could be "IMG", or "DSC", etc.

Image-001.jpg
Image-001-Copy.jpg
Image-001-Copy2.jpg
Image-002.jpg
Image-002-Copy.jpg
Image-003.jpg
Image-004.jpg
Image-004-Copy.jpg
Image-004-Copy2.jpg

So how do I accomplish this? Looks like I need to assign variables to the diff suffixes, group them by those variables, then rename all the diff group members to a new group prefix. But I'm not sure how to accomplish that. Any advice?

JTaylor

I would recommend using the FileSearch Extender (https://files.winbatch.com/downloads/wb/wsrch34i.zip) and then FileRename() function.    FileRename() allows you to do batch renaming so rather than having to search for files you could simply do a recursive run through all the folders, assuming your need was a simple as you explained.  If needed, you could do the same but go file by file.

I would also recommend copying a small portion of your files and directories to a new location for testing.

Jim

jmburton2001

I love Winbatch and have been using it since the 1990s. It's an incredibly versatile piece of software.

With that in mind I sometimes find it useful to use other "specialty" software to perform tasks without spending an inordinate amount of time to create a script. If I'm performing a massive rename of files (which I've been known to do) I've been using a program for many years called "Bulk Rename Utility".

You can check it out here -> https://www.bulkrenameutility.co.uk/

Once again, no disrespect to Winbatch or Tony. If you want to use Winbatch for the experience and a better understanding of its power and versatility, I certainly encourage it.

MikeInThe901

Ooh I've used that before and forgot about it! It does make it easy to be very specific with each character in a bulk rename. Thanks!