Batch rename filename_number + offset

Ideas for improvements and requests for new features in XnView Classic

Moderators: XnTriq, xnview

Post Reply
User avatar
Anika
Posts: 85
Joined: Wed Jul 28, 2004 12:18 pm

Batch rename filename_number + offset

Post by Anika » Tue May 05, 2009 1:08 pm

The problem:
I take stereo pictures with two similar cameras. But the filename_numbers of the corresponding pictures often are not the same. So I need to add an offset to the filename_number of a group of pictures. By now I use the batch rename with #### and a starting number. But this makes problems if the filename_numbers are not continously because I deleted some pics.

What I need:
538 -> 541
539 -> 542
541 -> 544
542 -> 545
543 -> 546

My solution suggestion:
<filename_number [+3]>

As workaround and additional feature, it would be useful to have an easy way to take the filename_number as starting number for ####and then use the up and down arrows.

Best regards,
Anika
XnView 2.04, 2.13 Windows 2000 SP4 and Windows XP SP3 and Windows 7 64bit

User avatar
Dreamer
XnThusiast
Posts: 4605
Joined: Sun Jul 25, 2004 9:08 pm
Location: Slovakia

Re: Batch rename filename_number + offset

Post by Dreamer » Wed May 06, 2009 5:25 pm

As workaround and additional feature, it would be useful to have an easy way to take the filename_number as starting number for ####and then use the up and down arrows.
This is already possible, just double-click the file in the Batch Rename dialog. You need to enable also options "Name template" and "Create new name template when opening dialog".

...but I think there is a better way - if you have two cameras and if delete some pictures. I'm using a date for all pictures, use "Insert >>" button, or type this: <Date Taken [Y-m-d_H-M-S]> . You may add also a camera model (<Model>) to distinguish the cameras. Then your files will look like this:

2009-05-01_20-59-58 DMC-TZ5
2009-05-01_21-03-49 DMC-TZ5
2009-05-01_21-08-23 SGH-F480
2009-05-01_21-08-30 DMC-TZ5


Date format is fully customizable, but I recommend the order Y m d H M S - then all files will be sorted by date - and date and time will be visible also in programs without EXIF date options - and also in DVD players, or MP4 players, for example. Another advantage is that you don't have to rename the files again, after you delete some.
Dreamer

User avatar
Anika
Posts: 85
Joined: Wed Jul 28, 2004 12:18 pm

Re: Batch rename filename_number + offset

Post by Anika » Thu May 07, 2009 11:05 am

Dreamer wrote:This is already possible, just double-click the file in the Batch Rename dialog. You need to enable also options "Name template" and "Create new name template when opening dialog".
This is a nice hint. But it has the same bug with numbers > 1000. If I want to change the suggested number with the arrow files I get 1.000.
http://newsgroup.xnview.com/viewtopic.p ... 582#p74137
Dreamer wrote:...but I think there is a better way - if you have two cameras and if delete some pictures. I'm using a date for all pictures, use "Insert >>" button, or type this: <Date Taken [Y-m-d_H-M-S]> . You may add also a camera model (<Model>) to distinguish the cameras.
I do this already. My template is
<Date Taken [Y-m-d_H-M]>_S<Filename Number>_L
S is for the Canon A720IS with StereoDataMaker (N for Nikon D90, F for Finepix 9500, C for Casio QV4000). I just want only one character, to keep the filename short. <Model> would be too long.
L is for left picture
I use the date without seconds because the synchronisation of the Date Taken of two cameras is much more difficult than the Filename Number. Even if the cameras are just some seconds different I have about 10% picures where even the minute is not the same. So I want to keep the Filename Number to be sure and to have an short identifier that is easier to rember.
I guess I have to wait for the progammer of stereomasken, who has started a program for managing and renaming stereo pictures.

So an offset still would be nice.
Best regards,
Anika
XnView 2.04, 2.13 Windows 2000 SP4 and Windows XP SP3 and Windows 7 64bit

PatrickMc
Posts: 2
Joined: Sun May 31, 2009 3:10 pm

Re: Batch rename filename_number + offset

Post by PatrickMc » Sun May 31, 2009 3:34 pm

Anika:

You can use biterscripting to rename and re-sequence file names. I am not sure exactly how your files are currently named, and how the L and R are corelated, so I will write for you a simple script that renames files in a folder.

Code: Select all

# Collect a list of files in folder C:\somefolder 
var str list ; lf -n "*" "C:\somefolder" > $list
# Start renaming files from 23 (as example).
var int number ; set $number = 23
# Rename files one by one.
while ($list <> "")
do
    # Get the next file.
    var str file ; lex "1" $list > $file
    # Rename file to "something_$number.extn".
    system rename ("\""+$file+"\"") ("something_"+makestr(int($number))+".extn")
    # Incerment $number
    set $number = $number + 1
done
I like such flexibility in a tool such as biterscripting. You can download biterscripting from http://www.biterscripting.com free.

Patrick

Post Reply