How to bulk rename numbered files?

6

2

I have two folders in Windows 8.1. The first folder, a, has 50 .jpg files numbered 01.jpg through to 50.jpg. My second folder, b, has the same amount of .jpg files named in the exact same manner.

My goal is to merge these two folders, but rename the files in b 51.jpg through to 100.jpg so that they stay in the same order.

Max

Posted 2015-02-27T07:26:03.067

Reputation: 77

Question was closed 2015-05-05T04:55:16.030

3Can you please add details on what operating system you are using to this question? – JakeGould – 2015-02-27T07:33:17.840

This question on SoftwareRecs.SE is relevant. The answers there might help: http://softwarerecs.stackexchange.com/q/11389/6834

– Tymric – 2015-02-27T10:58:48.243

Answers

13

  1. Select all the files from a folder. Rename the first file from the selection as a- numbering will take place on its own.
  2. Similarly rename b folder as b-
  3. Then move files from b folder to a. (Asuming you have sort on name)
  4. Again rename files as img-
    You will have the numbering as img-1.....

Nikitesh Kolpe

Posted 2015-02-27T07:26:03.067

Reputation: 328

1It matters which file is the first to get renamed, so it'd be good instruct renaming the first file in the selection, given that it's sorted. – Louis – 2015-02-27T07:38:47.677

-1 cause it is simply a solution to do it manually, which in my opinion has nothing to do with a super user... – Oliver Friedrich – 2015-02-27T08:36:46.317

@BeowulfOF You could probably use voice command to "automate" it a bit more. It might be a bit cumbersome, but it still gets the job done and it's probably the easiest/quickest solution that doesn't require any specific or additional setup. – Mario – 2015-02-27T08:41:23.037

manually renaming 100 files is definitely slower than using a script and onboard-tools... easiest maybe. – Oliver Friedrich – 2015-02-27T08:42:35.420

2@BeowulfOF Typing the new name happens once... The other selected files will automatically get updated. It's actually much faster (mostly mouse work) and safer (supported by the undo button) for many than editing and running a script. – Louis – 2015-02-27T11:38:01.147

1I had no idea any GUI file browser had multi-file rename via selection semantics like this. Will have to try that in some GNU/Linux ones. (or just keep using prename s/foo/bar/ *.jpg to throw perl regexes at my file renaming problems. :) – Peter Cordes – 2015-02-27T15:30:02.680

13

Windows 8.1 have PowerShell build-in, so you can use something like this:

1..50|Rename-Item -Path {'{0:00}.jpg'-f$_} -NewName {'{0:00}.jpg'-f($_+50)}

In the above, the first 0 in {0:00} specifies the parameter index, and the second 00 specifies the format as two digits padded with zeroes.

user364455

Posted 2015-02-27T07:26:03.067

Reputation: 2 679

3

Highly recommend IrfanView. It has the most amazing customization for bulk renaming files.

More details here: http://www.irfanview.com/faq.htm#Q13

psam

Posted 2015-02-27T07:26:03.067

Reputation: 31

3

This would probably be better asked on SoftwareRecommendations.SE, but I will say that I have used the free Bulk Rename Utility on many occasions and found it to be very helpful, easy to use, and extremely powerful.

Screenshot of Bulk Rename Utility

Unlike a lot of freeware, the interface is concise and native, and the software is entirely free so you don't have to be bothered with trial restrictions and annoyances common in freeware. I personally found it very helpful when organizing my music library.

(I am in no way affiliated with the author)

Keavon

Posted 2015-02-27T07:26:03.067

Reputation: 1 130

+1 for this. This is also my go-to tool for bulk renaming. The beauty of this tool is that one can 'preview' the result first, and the filelist pane allows renaming "all files but one/N" easily: Ctrl-A then just Ctrl-Click to unselect those you don't want to rename. – pepoluan – 2015-02-28T14:07:13.567

+1 for informing me about https://softwarerecs.stackexchange.com/. I had no idea that existed.

– Feckmore – 2015-03-06T21:32:24.670

2

This is old and maybe too complex, but in CMD.exe you could solve it like this:

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

SET COUNTER=1
FOR %%A IN ("a","b") DO (
    SET FOLDER=%%A
    FOR /F %%F IN ('DIR /B /ON !FOLDER!') DO (
        SET FILE=%%F
        COPY !FOLDER!\%%F c\!COUNTER!!FILE:~-4!
        SET /A COUNTER= !COUNTER! + 1
    )
)  

Oliver Friedrich

Posted 2015-02-27T07:26:03.067

Reputation: 577

0

I'd recommend http://www.advancedrenamer.com/ as an alternative "easy-button" answer. I actually use it all the time for batch-renames where I need a certain pattern, or need to remove silliness from other people's mashed-up filenames ;-)

NateJ

Posted 2015-02-27T07:26:03.067

Reputation: 174

0

Similar to Niki above use DOS or the CMD utility.

In DOS C:\FolderA> (move to folder with A files)
Rename all the files in one go REN \*.jpg A-\*.jpg

go to B folder using CD - change directory
Rename all the files in one go REN \*.jpg B-\*.jpg

Then copy b-files to A folder.
Copy B\*.jpg c:\FolderA\

Richard

Posted 2015-02-27T07:26:03.067

Reputation: 1