8

I have a problem with filenames. The stupid camera I am using resets the autonumber sequence every so often, and therefore I am getting tons of conflicts if I try and put lots of photos in a single file.

I know there is a way to rename them all to something like the following:

1.jpg, 2.jpg, 3.jpg . . . 2000.jpg, etc...

Unfortunately, I am among the generation who never really used DOS much before Windows came out with all its fake gimmicks. I have tried finding an app to do this, but they are quite pathetic, so I want to just do it in either the Windows .cmd or just a plain .bat (that's where I found some decent control over files). Can anyone help me out with the code?

4
  • 4
    Windows console window has absolutely nothing to do with MS-DOS. Oct 18, 2011 at 17:14
  • There are very few people who would consider batch files "code". Oct 18, 2011 at 17:20
  • 1
    @Cat except for the commands. Almost all the commands are the same as in DOS, except for some new ones that were added in Windows Nov 14, 2011 at 20:06
  • did you make any research effort yourself?
    – Dave
    Mar 4, 2014 at 6:38

8 Answers 8

3

I've been loving the command line since the mid 80's but I have to admit this is one area where I always rely on Rename-It! I know you want DOS but I'll leave this one just in case someone stumbles through that hasn't heard of it.

During times when I needed extreme control over individual files (usually in groups) I have used a spreadsheet to build the batch file. In this case I use DIR/B to collect file names into a text file, paste them into one column, build the renaming command in a final column (D in this case) then paste that column into a .BAT file and run it.

enter image description here

13

The following Batch file do what you want:

@echo off
setlocal EnableDelayedExpansion
set i=0
for %%a in (*.jpg) do (
    set /a i+=1
    ren "%%a" "!i!.new"
)
ren *.new *.jpg

Files are first renamed with .new extension to avoid conflicts with the files being processed and then renamed back to .jpg at end.

0
4

You can use ReNamer and define any logical rules you want. Delete, Replace, Cleanup, Regex, Insert meta tags, even script out your custom rule.

Below is an example of rules for renaming sequences of images from the digital camera:

  1. Delete: Delete from Position 1 until the End (skip extension)
  2. Insert: Insert "New Name " as Suffix (skip extension)
  3. Serialize: Serialize Incremental from 1 step 1 repeat 1 and pad to length 3 as Suffix (skip extension)

enter image description here

2

This will do what you want from the command line, using a batch file:

@echo off
SET COUNT=1
SET PREFIX=Photos
FOR /f "tokens=*" %%G IN ('dir /b *.jpg') DO (call :renum "%%G")
GOTO :eof

:renum
 ren %1 %PREFIX%_%count%.jpg
 set /a count+=1
 GOTO :eof

Based on some example code at SS4.

0

Not really a programming question, or rather something that can somehow be solved through plain windows ui. As far as I know, this only works on Windows 7, but if you select a bunch of files, and you press F2, or Right-click->rename, you can rename the first one, and the rest will get the same name, with (1), (2), (3) and so on appended to it. The file extensions remain unchanged.

0

If your camera tags the photos with information (often EXIF tags), and your camera's clock is at least almost accurate, you could use any of the varied file renaming utilities to use that data to rename (and sort into folders, if you'd like) your photos by their timestamps.

exiv2 is a command line utility that can do the job, and den4b's ReNamer is a GUI utility that will do the job as well. ReNamer is a general purpose renamer, it's not photo specific. exiv2 is primarily a photo tag manipulation tool that also does renaming.

1
  • Nope, the camera was a very stupid model. It looses all time, dates, and all the tags get messed up :(
    – JohnRoux
    Oct 18, 2011 at 21:01
0

This GUI app will do a sequential file re-naming 01,02,03 or 0102,0103,0104. It is very old, I could not find the authors site anymore.

http://www.mediafire.com/?71797x4vuv1u6mo (156k zip 300k single executable portable app called renmfl.exe)

I use it to rename many files for stringing in order. It will load sorted As selected, then put simple sequential numbering on the files loaded in (use CTRL A when selecting whole folder so all files to be in order) . It will also start at a specific number.

It is limited in length of all the file names (quantity of files at a time), due to the file loading method. It will not allow manuel resort of the files prior to numbering (just alphabetical). you can also put a tag on but I never used that feature. YoSemiPic401 , YoSemiPic402, YoSemiPic403 . etc

It only does one type of renaming, but for that type it does it well, it leaves extentions as is, I use a different program for that.


"superb batch renamer" which is about 10 times more complex, will do sequential numbering additions in the Append section, or random, or about anything else you can think of.

http://www.mediafire.com/?vxgmac394cx03te (350k Zip 666k portable executable , E-mail ware)

To set a sequentials in it, hit F2 to get into advanced mode, select [x] Append to turn it on, IN the append text entry box Right click, in there is an array of things you can append. One of them being Sorted number.

-1

Not a programming question.

Use the REN command.

http://ss64.com/nt/ren.html

1
  • Ya, sorry it isnt entirely related the the idea behind this site. @Nick Brooks , yes, but i cant find any way to rename the files with an incriminting number. I gathered i would have to write a batch file, but i am severly lacking in .bat coding knoledge, thats where the slight programming comes in :D
    – user1001652
    Oct 18, 2011 at 17:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .