Rename multiple photos in just one click

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
ka_poroy
Posts: 6
Joined: 28 Nov 2013 22:16

Rename multiple photos in just one click

#1 Post by ka_poroy » 28 Nov 2013 22:40

hi Sirs,

I'm just a newbie here in batch programming..I just want to ask if there is other formula/code/way to rename the files(Photos) below?because I'm just using REN function to rename all of this files but its not working.

REN jan example number-1001.jpg jan example number.jpg
REN feb example number-1002.jpg jan example number.jpg
REN mar example number-1003.jpg jan example number.jpg
REN apr example number-1004.jpg jan example number.jpg
REN may example number-1005.jpg jan example number.jpg
REN jun example number-1006.jpg jan example number.jpg
REN jul example number-1007.jpg jan example number.jpg
REN aug example number-1008.jpg jan example number.jpg
REN sep example number-1009.jpg jan example number.jpg
REN oct example number-1010.jpg jan example number.jpg
REN nov example number-1011.jpg jan example number.jpg
REN dec example number-1012.jpg jan example number.jpg
REN jan example number-1013.jpg jan example number.jpg
REN feb example number-1014.jpg jan example number.jpg
REN mar example number-1015.jpg jan example number.jpg
REN apr example number-1016.jpg jan example number.jpg
REN may example number-1017.jpg jan example number.jpg
REN jun example number-1018.jpg jan example number.jpg

hope somebody there with a good heart can help me.

Thanks and more power!

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Rename multiple photos in just one click

#2 Post by foxidrive » 28 Nov 2013 23:02

ka_poroy wrote:hi Sirs,

just want to ask if there is other formula/code/way to rename the files(Photos) below?because I'm just using REN function to rename all of this files but its not working.

REN jan example number-1001.jpg jan example number.jpg
REN feb example number-1002.jpg jan example number.jpg
REN mar example number-1003.jpg jan example number.jpg
REN apr example number-1004.jpg jan example number.jpg
REN may example number-1005.jpg jan example number.jpg
REN jun example number-1006.jpg jan example number.jpg
REN jul example number-1007.jpg jan example number.jpg
REN aug example number-1008.jpg jan example number.jpg
REN sep example number-1009.jpg jan example number.jpg
REN oct example number-1010.jpg jan example number.jpg
REN nov example number-1011.jpg jan example number.jpg
REN dec example number-1012.jpg jan example number.jpg
REN jan example number-1013.jpg jan example number.jpg
REN feb example number-1014.jpg jan example number.jpg
REN mar example number-1015.jpg jan example number.jpg
REN apr example number-1016.jpg jan example number.jpg
REN may example number-1017.jpg jan example number.jpg
REN jun example number-1018.jpg jan example number.jpg


If you have spaces and ampersands then you need double quotes.

REN "jan example number-1001.jpg" "jan example number.jpg"

But you can't rename all those photos to the same name.

ka_poroy
Posts: 6
Joined: 28 Nov 2013 22:16

Re: Rename multiple photos in just one click

#3 Post by ka_poroy » 28 Nov 2013 23:27

Thanks Sir Foxidrive for the tip.Do you have other batch code to rename these file?just in case if this one not work I still have an alternative.
Sorry I,ve Posted wrong example.

this one is correct.

REN jan example number-1001.jpg jan example number.jpg
REN feb example number-1002.jpg feb example number.jpg
REN mar example number-1003.jpg mar example number.jpg
REN apr example number-1004.jpg apr example number.jpg
REN may example number-1005.jpg may example number.jpg
REN jun example number-1006.jpg jun example number.jpg
REN jul example number-1007.jpg jul example number.jpg
REN aug example number-1008.jpg aug example number.jpg
REN sep example number-1009.jpg sep example number.jpg
REN oct example number-1010.jpg oct example number.jpg
REN nov example number-1011.jpg nov example number.jpg
REN dec example number-1012.jpg dec example number.jpg

ka_poroy
Posts: 6
Joined: 28 Nov 2013 22:16

Re: Rename multiple photos in just one click

#4 Post by ka_poroy » 29 Nov 2013 00:43

If you have spaces and ampersands then you need double quotes.

REN "jan example number-1001.jpg" "jan example number.jpg"



Sir, this one is not working also..=(

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Rename multiple photos in just one click

#5 Post by foxidrive » 29 Nov 2013 00:54

ka_poroy wrote:
REN "jan example number-1001.jpg" "jan example number.jpg"

Sir, this one is not working also..=(


What error do you get?

ka_poroy
Posts: 6
Joined: 28 Nov 2013 22:16

Re: Rename multiple photos in just one click

#6 Post by ka_poroy » 29 Nov 2013 01:13

It's showing invalid switch - number

and I removed the - sign and replace with space

again error showing

the system cannot find the file specified

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Rename multiple photos in just one click

#7 Post by foxidrive » 29 Nov 2013 02:48

Firstly, you might have a REN.BAT or REN.CMD somewhere in the folder.
Secondly, make sure you have the quotes where I showed you.
Finally, make sure the name is spelled correctly.


Then try it again and tell us how it goes, including any error messages.

I know you want to script this and make it more useful, but get it working with one file to make sure, first.

Endoro
Posts: 244
Joined: 27 Mar 2013 01:29
Location: Bozen

Re: Rename multiple photos in just one click

#8 Post by Endoro » 29 Nov 2013 05:38

Why do you need more than one threads: stackoverflow

ShadowThief
Expert
Posts: 1164
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Rename multiple photos in just one click

#9 Post by ShadowThief » 29 Nov 2013 05:50

ka_poroy wrote:It's showing invalid switch - number

and I removed the - sign and replace with space

again error showing

the system cannot find the file specified

http://i.imgur.com/gKXieXZ.png

ka_poroy
Posts: 6
Joined: 28 Nov 2013 22:16

Re: Rename multiple photos in just one click

#10 Post by ka_poroy » 29 Nov 2013 07:05

thank you sirs for the help!!!especially you sir foxidrive. its ok now.more power!

rodrigolima
Posts: 21
Joined: 19 Jul 2013 11:35
Location: Brazil

Re: Rename multiple photos in just one click

#11 Post by rodrigolima » 29 Nov 2013 07:08

Hello ka_poroy

I saw your post.

Here in my computer, I applied that one

After rename process:

BEFORE RENAME AFTER RENAME
jan example number-1001.txt-> jan example 1001.jpg
feb example number-1002.txt-> feb example 1002.jpg
mar example number-1003.txt-> mar example 1003.jpg
apr example number-1004.txt-> apr example 1004.jpg
may example number-1005.txt-> may example 1005.jpg
jun example number-1006.txt-> jun example 1006.jpg
jul example number-1007.txt-> jul example 1007.jpg
aug example number-1008.txt-> aug example 1008.jpg
sep example number-1009.txt-> sep example 1009.jpg
oct example number-1010.txt-> oct example 1010.jpg
nov example number-1011.txt-> nov example 1011.jpg
dec example number-1012.txt-> dec example 1012.jpg

Below it goes the script:

Code: Select all

@echo off
cls

:: Author: Lima, Rodrigo Sant Anna
:: Date: November 29th,2013

if exist pipeline.txt del pipeline.txt

:: Regular Expression
:: Pattern: ^[a-zA-Z]{3} example number-[0-9]{4}.jpg$
dir /b "??? example number-????.jpg" > pipeline.txt

SETLOCAL EnableDelayedExpansion

For /f "tokens=1,2 delims=-" %%a in (pipeline.txt) do (

   set month=%%a
   set num=%%b

   :: Rename Old Signature to New Signature
   ren "%%a-%%b"  "!month:~0,3! example !num:~0,4!.jpg"

)

EndLocal

if exist pipeline.txt del pipeline.txt
goto:eof


I have tested here and it works perfectly.Please test it in your environment and I hope
that it is useful for you.

See you

ka_poroy
Posts: 6
Joined: 28 Nov 2013 22:16

Re: Rename multiple photos in just one click

#12 Post by ka_poroy » 29 Nov 2013 10:04

Thanks rodrigolima for your help

Post Reply