Copy link to clipboard
Copied
Hello Community,
filenames out of the camera are set as _DSC1.* _DSC2.*, _DSC3.* …
My Batch Renaming procedure includes MMSS to ensure right chronological sequence:
(Another text line not shown, as last step to add model).
What I get is:
So Milliseconds are reflected as 000 in the renaming procedure although they are included in the metadata: File info:
How do I get this to work correctly? Result should be: 20240928_102028980_D750
These issues have been reported earlier Adobe Bridge Batch rename - issues to include mill... - Adobe Community - 12519842 but doesn’t seem to be fixed yet?
Thanks for your ideas!!
Martin
(Bridge 14.1, Windows 11)
For what it's worth, here is the Bridge script to batch rename using milliseconds:
/*
Batch Rename to YYYYMMDD_HHMMSSMS_D750.jsx
v1.0 - 3rd October 2024, Stephen Marsh
https://community.adobe.com/t5/bridge-discussions/batch-renaming-issue-with-milliseconds/td-p/14886235
Rename from:
_DSC1.jpg
_DSC1.NEF
to:
YYYYMMDD_HHMMSSMS_D750.jpg
YYYYMMDD_HHMMSSMS_D750.NEF
With the MS or Millisecond value being the only unique part of the filename.
Note: Bridge 2024 fails to refresh, so refresh/F5 man
...
Copy link to clipboard
Copied
Offhand my suggestion would be to use another program such as the CLI ExifTool if the milliseconds are critical.
https://www.dyxum.com/dforum/metadata-for-milliseconds_topic138111.html
https://exiftool.org/forum/index.php?topic=15297.0
I don't have any images at hand that include millisecond metadata for testing.
Rather than using milliseconds, you could use a numerical sequence to avoid the rename clash (1) etc.
Copy link to clipboard
Copied
Yes, I tried this numerical sequence option, but doesn't work either. Bridge puts the files in upside down order:
1 - 2024-09-28 10:20:28.98
2 - 2024-09-28 10:20:28.65
3 - 2024-09-28 10:20:28.49
(extracted from file info, origin).
This is why I'd like to add the millisec. Seems to be the only chance to get the correct order via sorting by file name, when HHMMSS are the same.
Thank you guys for your help.
Copy link to clipboard
Copied
Can you provide sample images containing millisecond metadata? They can be reduced in pixel size as it's only the intact metadata that is important for testing.
Batch Rename should use the sort order.
Copy link to clipboard
Copied
It seems to be really weird.
If using the numeric sequence as (last) step of the Batch Rename operation the resulting sequence order seems to be dependent on the sequence you select the files to be processed.
In other words:
1. These are the files out of the camera. As you can see in the thumbnail, I focused the left edge of the book and moved the camera to the right, shutter release in Continuous High
2. Now shift + click to select 6510, and hold shift + arrow down to select 6511 and 6512 as well. All three are selected.
3. Batch Rename
4. Result: correct sequence, first shot is placed first.
5. Now different approach: shift + click to select 6512, shift + arrow up to select 6511 and 6510 as well
6. Identical Batch Rename procedure
7. Result: inverted sequence, i.e. first shot (book to the far right) placed last.
Sorry, but this is strange, isn't it? Or else, what do I miss?
Copy link to clipboard
Copied
As you haven't supplied any samples, I'm still trying to find some with intact metadata for testing.
Copy link to clipboard
Copied
Hi Stepehn, sorry for delay. Files attached. Looked for some way to make them smaller without changing NEF-format, but didn't find.
Copy link to clipboard
Copied
6511
Copy link to clipboard
Copied
You can't email attachments to the forum, you need to use the website interface.
Just save a copy as JPEG, you can crop it or downsize it, as long as it has the original metadata it could be 1 x 1px in size.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Unlike earlier versions, Bridge 2024 (14.0.0.102) appears to be able to correctly rename using the milliseconds value!
P.S. For the sake of completeness, I'll post an ExifTool command tomorrow and look into a script for renaming for earlier versions of Bridge, it's bedtime now!
Copy link to clipboard
Copied
Ha, it's buggy!
I quit Bridge 2024 after taking that screenshot, then tried in 2023 where it used 000, then went back to Bridge 2024 and it flaked out and used 000.
Copy link to clipboard
Copied
Buggy? No way.
Copy link to clipboard
Copied
Buggy? No way.
By @Lumigraphics
I know, truly unbelievable!
I used to wonder if Bridge would be any different if it was a paid product.
Copy link to clipboard
Copied
Hi Stephen, thx for reproducing this issue. Tricky one to detect.
Could you please try to reproduce the described sorting bug as well (pls see above: 1. to 7., select original files one after the other, one time starting from the top and arrow down, the other time starting from the bottom and arrow up, each time then batch rename the selected 3 files with a sequence number - and can you reproduce different results in sequencing?)
!!THX!!
Copy link to clipboard
Copied
And another follow up: I would say it's superbuggy!
Rename procedure, as you did, with the original JPGs, and same result as yours: millisec reflected.
Same procedure with original NEFs: you get 000s and milliseconds are gone.
Copy link to clipboard
Copied
You may need to use a script or EXIFTool to extract the millisecond data and write it to another XMP field where it can be used. I realize this just adds complexity but if its properly scripted can be fairly painless.
I have some data handled this way since I use Bridge for image processing in production and need things automated as much as possible.
Copy link to clipboard
Copied
Hi Lumigraphics, Hi Stephen,
yes, scripting could be a solution, hm, but sounds rather complex for my little expertise...
At the beginning of the story was my request to keep the correct order of Continuous High shots after renaming, that couldn't be seperated via HHMMSS metadata. The idea was to solve that issue via adding millisec. This approach revealed the bug with the 000s, so no solution from there. Then the point appeared that it matters where you start selecting the files for renaming, top or bottom, to achieve correct order.
Now I figured out the following process to get what I want, lean enough and working for me:
1. Select the whole bunch of original NEF files in the directory to be renamed. Be sure not to select any single file prior to CTRL + A. Or either if you only want to select some files in the directory, be sure to select the one at the top (first shot of the series) and arrow down.
2. Batch rename (my pattern: yyyymmdd_hhmmss_cam.NEF). After that 90% of my files are correctly renamed and in good order. Few files look like yyyymmdd_hhmmss_cam (1).NEF, ... (2).NEF etc., when Bridge needs to additionally separate files.
3. One file out of the group doesn't have an additional number, which is the first one of the quick shots. Manually attach a (0) to this file.
4. 2nd Batch Rename procedure with a Regex String Substitution for this group of files only.
Regex Code: (Find) (\d{8})_(\d{6})_([A-Za-z0-9]+) \((\d+)\) (Replace) $1_$2_$4_$3
ChatGPT created the code for me 🙂
5. Result: yyyymmdd_hhmmss_0_cam.NEF, yyyymmdd_hhmmss_1_cam.NEF, which brings this group of files in exact the right order when sorted by file name.
6. Remark: why not placing the counter at the end? Because I use manually attached counters at the end for duplicates when they are substantially edited (intense crop, change of format, etc.)
Works for me like a charm.
Copy link to clipboard
Copied
Glad you have a workable solution!
I'm still going to explore both ExifTool and scripting to see if the millisecond issue can be otherwise resolved (I'm like a dog with a bone, and I'm not done chewing this one!).
Copy link to clipboard
Copied
P.S. For the sake of completeness, I'll post an ExifTool command tomorrow and look into a script for renaming for earlier versions of Bridge, it's bedtime now!
OK, I have come up with a workable ExifTool command. Work on duplicate files for safety, or change -filename to -testname until you are happy with the results.
The results from the 3 test images are:
20241001_07283961_D750.jpg
20241001_07283976_D750.jpg
20241001_07283991_D750.jpg
Using two sequential regular expressions to delete all directory colon : separators and change all word spaces to underscore characters with a hard-coded camera model number '_D750' and a variable filename extension:
exiftool '-filename<${DateTimeOriginal;s/://g;s/ /_/g}${SubSecTimeOriginal}_D750.%e' -r
____________
Rather than hard-code in the name of the Nikon D750 model, one can get the make/model metadata and regex to remove the make from 'NIKON D750' to leave the model 'D750':
exiftool '-filename<${DateTimeOriginal;s/://g;s/ /_/g}${SubSecTimeOriginal}_${model;s/(^.+ )(.+$)/$2/}.%e' -r
Copy link to clipboard
Copied
This variation on the previous examples adds options to preserve file modification date/time, allow the original file attributes to be preserved & preserve the original filename:
exiftool -P -overwrite_original_in_place '-XMP-xmpMM:PreservedFileName<${filename;s/\.[^.]*$//}' -execute '-filename<${DateTimeOriginal;s/://g;s/ /_/g}${SubSecTimeOriginal}_${model;s/(^.+ )(.+$)/$2/}.%e' -common_args -r
As this variation overwrites the original to add the preserved filename metadata, in addition to the renaming, it is best to work on copies of the originals until you are happy with the results.
Copy link to clipboard
Copied
For what it's worth, here is the Bridge script to batch rename using milliseconds:
/*
Batch Rename to YYYYMMDD_HHMMSSMS_D750.jsx
v1.0 - 3rd October 2024, Stephen Marsh
https://community.adobe.com/t5/bridge-discussions/batch-renaming-issue-with-milliseconds/td-p/14886235
Rename from:
_DSC1.jpg
_DSC1.NEF
to:
YYYYMMDD_HHMMSSMS_D750.jpg
YYYYMMDD_HHMMSSMS_D750.NEF
With the MS or Millisecond value being the only unique part of the filename.
Note: Bridge 2024 fails to refresh, so refresh/F5 manually to see the renamed files!
*/
#target bridge
if (BridgeTalk.appName == "bridge") {
batchRename = new MenuElement("command", "Batch Rename to YYYYMMDD_HHMMSSMS_D750", "at the end of tools");
}
batchRename.onSelect = function () {
var sels = app.document.selections;
for (var z = 0; z < sels.length; z++) {
var thumb = sels[z];
var selectedFile = thumb.spec;
var md = new Thumbnail(selectedFile).synchronousMetadata;
md.namespace = "http://ns.adobe.com/xap/1.0/";
var cd = md.CreateDate;
// 2024-10-01T07:28:39.91
var dateTime = cd.replace(/(^\d{4})(?:-)(\d{2})(?:-)(\d{2})(?:T)(\d{2})(?::)(\d{2})(?::)(\d{2})(?:\.)(\d{2})/, '$1$2$3_$4$5$6$7');
var ext = selectedFile.name.replace(/(^.+)(\.[^\.]+$)/, '$2');
//alert(dateTime + "_D750" + ext);
File(selectedFile).rename(dateTime + "_D750" + ext);
}
alert("Custom Rename Completed!" + "\r" + "Manually select View > Refresh or press F5 in Bridge 2024!");
app.refresh();
}
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
This one works perfectly (Bridge 14.1.). THX!!
Copy link to clipboard
Copied
This variation on the previous script uses a variable model name, rather than hard-coding it in. It uses the last string of characters after the last word space character in the make/model metadata, i.e.:
NIKON D750
to
D750
Note: Updated to a 1.1 version to automatically preserve the original filename metadata before renaming.
/*
Batch Rename to YYYYMMDD_HHMMSSMS_MODEL.jsx
v1.0 - 5th October 2024, Stephen Marsh:
A variation on the previous script, swapping the hard-coded model for a variable, using a regular expression, i.e.: "NIKON D750" to "D750"
v1.1 - 5th October 2024, Stephen Marsh:
Added preserve current filename in metadata before renaming
https://community.adobe.com/t5/bridge-discussions/batch-renaming-issue-with-milliseconds/td-p/14886235
Rename from:
_DSC1.jpg
_DSC1.NEF
to:
YYYYMMDD_HHMMSSMS_MODEL.jpg
YYYYMMDD_HHMMSSMS_MODEL.NEF
With the MS or Millisecond value being the only unique part of the filename.
Note: Bridge 2024 fails to refresh, so refresh/F5 manually to see the renamed files!
*/
#target bridge
if (BridgeTalk.appName == "bridge") {
batchRename = new MenuElement("command", "Batch Rename to YYYYMMDD_HHMMSSMS_MODEL", "at the end of tools");
}
batchRename.onSelect = function () {
var sels = app.document.selections;
for (var z = 0; z < sels.length; z++) {
var thumb = sels[z];
var selectedFile = thumb.spec;
var md = new Thumbnail(selectedFile).synchronousMetadata;
var md2 = new Thumbnail(selectedFile).synchronousMetadata;
var md3 = new Thumbnail(selectedFile).synchronousMetadata;
md.namespace = "http://ns.adobe.com/xap/1.0/";
md2.namespace = "http://ns.adobe.com/tiff/1.0/";
md3.namespace = "http://ns.adobe.com/xap/1.0/mm/";
// Get the selected filename without extension
var Name = decodeURI(selectedFile.name).replace(/\.[^\.]+$/, '');
// Add the filename to the preserved filename metadata
md3.PreservedFileName = '';
md3.PreservedFileName = Name;
// Get the make/model metadata (i.e.: NIKON D750)
var makeModel = md2.Model;
// Remove the make to leave the model (i.e.: D750)
var model = makeModel.replace(/(^.+ )(.+$)/, '$2');
// Create date (i.e.: 2024-10-01T07:28:39.91)
var cd = md.CreateDate;
// Reformat the create date/time to YYYYMMDD_HHMMSSMS
var dateTime = cd.replace(/(^\d{4})(?:-)(\d{2})(?:-)(\d{2})(?:T)(\d{2})(?::)(\d{2})(?::)(\d{2})(?:\.)(\d{2})/, '$1$2$3_$4$5$6$7');
// Get the filename extension
var ext = selectedFile.name.replace(/(^.+)(\.[^\.]+$)/, '$2');
// Rename using a hard-coded, static camera model name
//File(selectedFile).rename(dateTime + "_D750" + ext);
// Rename using a variable camera model name
File(selectedFile).rename(dateTime + "_" + model + ext);
}
app.refresh();
}
Copy link to clipboard
Copied
6512