Batch Rename of Files

WIanB
Posts: 17
Joined: 05 Aug 08 15:37
Location: Salisbury, UK

Batch Rename of Files

Post by WIanB »

I'm sorry but I just cannot figure this out! Any help would be greatly appreciated.
I want to rename a a batch of files with a running sequence number. For example; batch of files are named "Trees-0001.dng" to "Trees-0100.dng" and i want to rename them "Flowers-0001.dng" to "Flowers-0100.dng". Also how would I add new files to the sequence? Example last file in the sequence is "Flowers-0100.dng" how would I now add new files starting with the next sequence number ie "Flowers-0101.dng" and onwards?
Ian
Home build - AMD 8 core 4.0 GHz, 16GB RAM, Windows 10. Photo Supreme 64 bit, Adobe Photo CC
Hert
Posts: 7911
Joined: 13 Sep 03 6:24

Re: Batch Rename of Files

Post by Hert »

Ian,

Something like this?

Code: Select all

%FileName-%ImageNumber{length=4;continuous}.%FileExtension
Hert
This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
WIanB
Posts: 17
Joined: 05 Aug 08 15:37
Location: Salisbury, UK

Re: Batch Rename of Files

Post by WIanB »

Hert,,

I am obviously doing something wrong! I copied & pasted %FileName-%ImageNumber{length=4;continuous}.%FileExtension into the Batch Rename Text box. As a test I did the following:
1. Selected 5 photos.
2. In the Batch Rename Text box edited the script to read "%Test-%0001{length=4;continuous}.%FileExtension"
3. Ran the Batch.

Result was 5 files renamed to "Test-0001{length=4;continuous}(001).dng", "Test-0001{length=4;continuous}(002).dng", "Test-0001{length=4;continuous}(003).dng" etc.

What am I doing wrong?
Ian
Home build - AMD 8 core 4.0 GHz, 16GB RAM, Windows 10. Photo Supreme 64 bit, Adobe Photo CC
weidmic
moderator
Posts: 861
Joined: 04 Dec 06 21:21

Re: Batch Rename of Files

Post by weidmic »

Ian,

%FileName is a macro command. When you use this then it just uses the filename of the actual file...
Because %test is not a macro, the formula is not going to work

If you want the word Test in your filename then remove the %

Code: Select all

Test-%0001{length=4;continuous}.%FileExtension
Regards,
Michael
PSUServer 2024.x, PostgreSQL 12.x
My homepage http://www.michaelweidner.com
WIanB
Posts: 17
Joined: 05 Aug 08 15:37
Location: Salisbury, UK

Re: Batch Rename of Files

Post by WIanB »

Thanks Michael, I'll give that a whirl.
Ian
Home build - AMD 8 core 4.0 GHz, 16GB RAM, Windows 10. Photo Supreme 64 bit, Adobe Photo CC
tstoddard
Posts: 605
Joined: 07 Sep 12 11:51

Re: Batch Rename of Files

Post by tstoddard »

Ian,

I believe you will also run into the same problem with "%0001", unless that is a shortcut I'm not aware of. To get the desired result I believe you need to use the macro command "%ImageNumber", as in the example, followed by the arguments inside the braces. There is an "offset" parameter that can be used to specify the starting number in the series. By default, it is set to 0 which results in the first number being 1. The IDImager documentation states that you would use the "continuous" parameter when "you want to use a continuous number which is persistent between invocations." The "length" parameter will determine how many leading zeros are used. I hope this helps.

On a side note, If the macro commands in PSU work identically to IDImager, it would sure be a good idea to port that section of the IDImager documentation into the PSU help documentation. Or at least create a new section in the PSU help documentation to explain how command macros work in PSU. This would go a long way in helping PSU stand on its own and not be considered just a newer version if IDImager.
Last edited by tstoddard on 20 Jan 13 17:15, edited 1 time in total.
Tom Stoddard
weidmic
moderator
Posts: 861
Joined: 04 Dec 06 21:21

Re: Batch Rename of Files

Post by weidmic »

Ian,
Tom is right, I did copy the wrong part into it without double checking... :oops:
It should be:

Code: Select all

Test-%ImageNumber{length=4;continuous}.%FileExtension
Regards,
Michael
PSUServer 2024.x, PostgreSQL 12.x
My homepage http://www.michaelweidner.com
WIanB
Posts: 17
Joined: 05 Aug 08 15:37
Location: Salisbury, UK

Re: Batch Rename of Files

Post by WIanB »

I am now completely and utterly confused! :cry: Why does the simple task of renaming files have to be so convoluted? I'm sorry but I am not a programmer of any description.
The closest I got to achieving my goal was "Test-0001.dng" "Test-0001(001).dng" "Test-0001(002).dng" etc. Where do I insert the number I want the sequence to start from and how do I get rid of the (nnn)?
What I want to achieve are files named "Test-0001.dng" "Test-0002.dng" "Test-0003.dng" etc.
I have tried every iteration of name and number, brackets, braces, commas and question marks, banging my head against the wall and have given up :D Photos imported into Lightroom, renamed them and then updated the folder in PSU. Took 2 minutes!
Ian
Home build - AMD 8 core 4.0 GHz, 16GB RAM, Windows 10. Photo Supreme 64 bit, Adobe Photo CC
weidmic
moderator
Posts: 861
Joined: 04 Dec 06 21:21

Re: Batch Rename of Files

Post by weidmic »

Ian,

That actually should work. Just looked it up in the old help file of IDImager V5.
I have not tried that yet because I don't have a test database with test images setup at the moment.
If you cant get it to work it might be possible that the macro is not parsed the way it should be?

Something Hert needs to look at.

Regards,
Michael

FYI: the (nnn) is a way to make the filename unique so no data is getting lost, just in case you have a rename rule that would create the same file name more than once.
PSUServer 2024.x, PostgreSQL 12.x
My homepage http://www.michaelweidner.com
WIanB
Posts: 17
Joined: 05 Aug 08 15:37
Location: Salisbury, UK

Re: Batch Rename of Files

Post by WIanB »

Hi Michael,
Yes I understand why the (nnn) appears. I still have IDimager v5 so will install it again and re-build the rename macro that I used there and copy it over, see if it works. The batch processor in IDi v5 was much easier to understand and use.
Many thanks for your help so far.
Ian
Home build - AMD 8 core 4.0 GHz, 16GB RAM, Windows 10. Photo Supreme 64 bit, Adobe Photo CC
Mike Buckley
Posts: 1194
Joined: 10 Jul 08 13:18

Re: Batch Rename of Files

Post by Mike Buckley »

Ian,

I recommend that you post a screenshot of your renaming command. That's because I have seen so many times in the past that the person having the problem had accidentally entered something other than he or she thought had been entered. Considering that all of us have made that mistake at least once, it's easy to understand how that can so easily happen.
WIanB
Posts: 17
Joined: 05 Aug 08 15:37
Location: Salisbury, UK

Re: Batch Rename of Files

Post by WIanB »

Mike,
I have tried the following:

1. Test-%0001{length=4;continuous}.%FileExtension. Result = "Test-0001{length=4;continuous}.dng" "Test-0001{length=4;continuous}(001).dng" "Test-0001{length=4;continuous}(002).dng" etc. I now understand why this does not work.

2. Test-%ImageNumber{length=4;continuous}.%FileExtension. Result = "Test-0001.dng" "Test-0001(001).dng" "Test-0001(002).dng" etc. I do NOT understand why this does not work.

What has me completely baffled is why the %ImageNumber is not incrementing but remains a constant 0001, hence the (nnn). Also, as mentioned by 'tstoddard' in a previous post I seem to be missing an 'offset parameter' as %ImageNumber always starts at 1 which is not what I want.

I had this working perfectly in IDi V5.
Ian
Home build - AMD 8 core 4.0 GHz, 16GB RAM, Windows 10. Photo Supreme 64 bit, Adobe Photo CC
tstoddard
Posts: 605
Joined: 07 Sep 12 11:51

Re: Batch Rename of Files

Post by tstoddard »

Ian,

Sorry this is causing you so much trouble. I would try removing the continuous parameter and see if that fixes the (nnn) issue. I think I had trouble getting continuous to work in the past. I usually don't use it.

The offset parameter is simply "offset = n" inside the braces. Try this to see if it works

Test-%ImageNumber{length=4;offset=9}.%FileExtension

Your names should start with Test-0010.dng

That still doesn't solve the problem of getting the renaming to automatically start at the number last used but at least you'll know that continuous is what is causing your problem.
Tom Stoddard
Mike Buckley
Posts: 1194
Joined: 10 Jul 08 13:18

Re: Batch Rename of Files

Post by Mike Buckley »

For what it's worth, if the "Continuous" parameter works the same in Supreme as it works in IDimager, there is no need to use it unless you are also configuring the "Increment" parameter to a value other than 1.

EDIT: I was wrong about that. The "Continuous" parameter does not work at all in IDimager unless the "Increment" parameter is also used. To that extent, the documentation is misleading. So, if you want the increment to be a value of 1, the easiest method is to simply not use the "Continuous" or the "Increment" parameter.
Hert
Posts: 7911
Joined: 13 Sep 03 6:24

Re: Batch Rename of Files

Post by Hert »

Ian,

I found a bug in the rename procedures when using the Continuous setting, so I can confirm that what you see is not how it's intended to be. This is fixed in the next update.
Sorry for the inconvenience.

Hert
This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
Post Reply