File number offset

Started by Aubrey, May 01, 2018, 03:36:02 PM

Previous topic - Next topic

Aubrey

I had to do a reset on my D500 camera.
This menas that files start from DSC_001.NEF again.

Is it possible to add an offset to a file number.

When I made the reset the file number was DSC_6377.NEF.

I would like to add 6377 to current file numbers.

I've looked in the renamer and my conclusion is that this is not possible.

Thanks
Aubrey

Mario

What do you mean by file number?
The file number refers to the number of the current file in the current sequence. Which means it is 1 for the first file.

Just use a global sequence and give it the offset of 6377.



In this example, the next file will get the number 92064 appended, then the sequence is incremented by 1.

See the Renamer Help for global sequence for more info.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

This might help... but not quite what I need!

What I really want to do is to extract a number and add a fixed value to it.
So given DSC_001.NEF ( and also DSC_001.jpg) as I record both jpg and NEF

I would like to extract 001, have it as a numeric value and add 6377 to it.
Then apply my usual bits'n'pieces that work and end up with:
AOC_D500_180501_06378.NEF and AOC_D500_180501_06378.JPG

Another file with DSC_020.NEF would send up with:
AOC_D500_180501_06397.NEF etc.

I don't think that there is the possibility of having addition available....(I suspect the renamer uses a "user friendly" version of regex), there have been discussions of addition function in other posts.

My alternative is just to start again, and assume the camera had reached 9999, in which case it would start again from 0001, then I will use the renamer to easily achieve:
AOC_D500_180501_10001.NEF , AOC_D500_180501_10001.JPG. I will then ignore the fact that there are no files from 6378 to 9999.

No big deal, just checking I wasn't missing something.


Thanks,
Aubrey.

PS: Problem came from an issue with Nikon firmware, the only way to solve was to do a hard reset on camera; although I did a save of settings prior to this, file number sequence is not saved!



Mario

You cannot perform mathematical operations with variables. If neither the index nor a global sequence number nor any of the 40 other steps and all the variable functions available to you do the job, you need to come up with a different solution. Surely Nikon provides a way to change the file offset number? Did you ask their support?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

Quote from: Mario on May 01, 2018, 04:53:16 PM
Did you ask their support?

One would expect that file number would be stored in settings when one saves settings!

You know what it's like speaking to camera vendors.....

Quote from: Mario on May 01, 2018, 04:53:16 PM
You cannot perform mathematical operations with variables.

My post was simply to confirm what I pretty well knew.

As I've I've said not a big issue, I'll simply add 10000 to file names, this is easy to do using renamer

or... as I'm thinking I may write a small awk script to do the job.



Mario

or... as I'm thinking I may write a small awk script to do the job.

This will require you to relocate each file afterwards when the files are already in the database. Do this before adding your files to IMatch for simplicity.
Or write a small IMatch app which can do this easily.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Aubrey

Can you not use a "dummy" file and store it with the wished number into your SD-Card and then put some pics with your Nikon?
Because usually Nikon catches then the last number in the folder and you have again your correct number.
Best wishes from Switzerland! :-)
Markus

Aubrey

Excellent idea... I'll try that and report back.

In the meantime I've written an awk script to do what I need. I put a list of the files into a file then run the script that is in a file rename.awk
BEGIN {
FS = "_|\\."
}
{
print "mv " $0,$1"_"$2+6377"."$3
}

run using awk -f rename.awk filelist > move.bat

Than I run the move.bat

(mv might seem strange, I have a linux emulator on my windows pc)

Aubrey.

BTW double backslash needed on "." as \. is a special character in searches, I need "." to be treated as a literal.

Some output:
mv DSC_0002.JPG DSC_6379.JPG
mv DSC_0002.NEF DSC_6379.NEF
mv DSC_0003.MOV DSC_6380.MOV
mv DSC_0004.MOV DSC_6381.MOV
mv DSC_0005.JPG DSC_6382.JPG
mv DSC_0005.NEF DSC_6382.NEF
mv DSC_0006.JPG DSC_6383.JPG



Aubrey

Quote from: sinus on May 01, 2018, 06:09:21 PM
Aubrey

Can you not use a "dummy" file and store it with the wished number into your SD-Card and then put some pics with your Nikon?
Because usually Nikon catches then the last number in the folder and you have again your correct number.
Excellent idea and it worked....
I made an image with reformated SD card. DSC_0023.NEF
Then went to PC and renamed image  DSC_6400.NEF
Reinserted card in camera
Took another image it is called  DSC_6401.NEF Wow!!!
Reformatted SD card, and took another image
DSC_6402.NEF perfect!

I owe you a beer one day when we meet up!

Aubrey.



sinus

Quote from: Aubrey on May 01, 2018, 06:39:52 PM
Quote from: sinus on May 01, 2018, 06:09:21 PM
Aubrey

Can you not use a "dummy" file and store it with the wished number into your SD-Card and then put some pics with your Nikon?
Because usually Nikon catches then the last number in the folder and you have again your correct number.
Excellent idea and it worked....
I made an image with reformated SD card. DSC_0023.NEF
Then went to PC and renamed image  DSC_6400.NEF
Reinserted card in camera
Took another image it is called  DSC_6401.NEF Wow!!!
Reformatted SD card, and took another image
DSC_6402.NEF perfect!

I owe you a beer one day when we meet up!

Aubrey.

Great, cool, that it worked. Very good, glad, that I could help.

Oh, great, a beer!  :D
The world is small and who knows, maybe we will meet some day!?  8)
Best wishes from Switzerland! :-)
Markus

ubacher

Not sure why this jump (back) in numbers is an issue for you. You will obviously get duplicate names once you go over 9999.
This means you need another way (other than name) to to display your files in historic order.

thrinn

I think Aubrey takes the image number only as one part of the file name.
Quote from: Aubrey on May 01, 2018, 04:50:53 PM
Then apply my usual bits'n'pieces that work and end up with:
AOC_D500_180501_06378.NEF and AOC_D500_180501_06378.JPG
Together with the date part there will be no dulicates (unless he shoots more than 10.000 pictures on the same day...)
Thorsten
Win 10 / 64, IMatch 2018, IMA

Aubrey

Quote from: ubacher on May 05, 2018, 08:00:02 PM
Not sure why this jump (back) in numbers is an issue for you. You will obviously get duplicate names once you go over 9999.
This means you need another way (other than name) to to display your files in historic order.

Thrinn is correct, I only take the file number as part of the file name.
Currently the camera has file names DSC_6378.NEF
When I go over 10,000, as you correctly says the file numbers reset to 0.
What I do is modify the file name in the camera to DS1_0001.NEF etc.
And then when it rolls over again to DS2_0001.NEF

This is easy to parse in the renamer to 10001.NEF and 20001.NEF

The only change I would make if redoing the naming would be to specify the  year with 4 digits rather than the last 2 digits!

Aubrey.

Aubrey

Quote from: sinus on May 01, 2018, 08:25:09 PM

Great, cool, that it worked. Very good, glad, that I could help.


Markus,
I posted your solution on the Nikonians website.
I've had a few thank you's which should be for you!

https://www.nikonians.org/forum/topic/464-11230-11230/renumbering-files-after-reset-useful-tip

Aubrey.

sinus

Quote from: Aubrey on May 18, 2018, 07:12:23 PM
Quote from: sinus on May 01, 2018, 08:25:09 PM

Great, cool, that it worked. Very good, glad, that I could help.


Markus,
I posted your solution on the Nikonians website.
I've had a few thank you's which should be for you!

https://www.nikonians.org/forum/topic/464-11230-11230/renumbering-files-after-reset-useful-tip

Aubrey.

Thanks, Aubrey

Very kind of you!  :D
Best wishes from Switzerland! :-)
Markus