File names duplication issue

Started by LuksenSyn, January 13, 2022, 06:55:16 PM

Previous topic - Next topic

LuksenSyn

Hello! I have this situation where I am using a piece of software to merge metadata from a JSON file to pictures and videos. Some of these files are doubled which automatically gives them a (1) at the file ending. However, Windows has done this in a weird manner so that the file names between the media files and the JSON files do not match up. They are like this. PHOTO: "Photo(1).jpg" and ""Photo1.jpg(1).json". As you can see these file names do not match up which leads to the software that im using to fail. Is this possible to fix in Excel without having to do it manually for thousands of file names?

Dont mind that I mention ExifTool as "a piece of software". I copied it from another post I did about this on reddit.

StarGeek

It sounds like you're trying to merge json data from a Google takeout.  If this is so, you do not need to merge data if you didn't make any changes on the Google website.  Google does not remove any metadata from the files you uploaded.  You should check the files with the command in FAQ #3 to verify.

But otherwise, the best bet is to rename the json files to match the image files properly.  See this post for the command.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

LuksenSyn

Quote from: StarGeek on January 13, 2022, 07:49:16 PM
It sounds like you're trying to merge json data from a Google takeout.  If this is so, you do not need to merge data if you didn't make any changes on the Google website.  Google does not remove any metadata from the files you uploaded.  You should check the files with the command in FAQ #3 to verify.

But otherwise, the best bet is to rename the json files to match the image files properly.  See this post for the command.

Hmmm. I checked trough the thread you posted there. I can't get the command to work, guess I am just stupid or something lol. How should I write the file path?

I enter the command like this:

C:\Users\X-PC>exiftool -ext json -r -if '$Filename=~/(\.[^.]+)(\(\d+\)).json$$/i'  '-Filename<${Filename;s/(\.[^.]+)(\(\d+\)).json$/$2$1.json/}' D:\NAS\Photolibrary\Takeout\Google Foto\Photos from 2021\IMG_7823(1).jpg.json

The file can not be found

What am I doing wrong!!!???
Thanks!

StarGeek

If your are using Windows CMD, then you need to swap single/double quotes.  PowerShell would use single quotes.  Also, your file path contains a space.  You need to put quotes around that or else CMD sees it as two separate arguments.  Also, you list the file as IMG_7823(1).jpg.json, which isn't the pattern you listed in the first post.

Windows CMD
exiftool -ext json -r -if "$Filename=~/(\.[^.]+)(\(\d+\)).json$$/i" "-Filename<${Filename;s/(\.[^.]+)(\(\d+\)).json$/$2$1.json/}" "D:\NAS\Photolibrary\Takeout\Google Foto\Photos from 2021\IMG_7823.jpg(1).json"

Windows PowerShell
exiftool -ext json -r -if '$Filename=~/(\.[^.]+)(\(\d+\)).json$$/i' '-Filename<${Filename;s/(\.[^.]+)(\(\d+\)).json$/$2$1.json/}' 'D:\NAS\Photolibrary\Takeout\Google Foto\Photos from 2021\IMG_7823.jpg(1).json'
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).