Rename XML files based on other file in subfolders

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Rename XML files based on other file in subfolders

Postby tusharbhutt » Sun Dec 03, 2017 10:01 pm

Hello,

new user here, and sorry if this has been asked before but the search function on the forum actively refuses to locate some common words (rename, extension, another, etc) so I am resorting to asking.

I am using version 2.7.x.x and I am dealing with the following:

1. I have one folder, with 400 folders in it.
2. In each folder is a main photo file with an extension of either .JPG, .CR, or .CR2. There may be an AVI or two as well.
3. There is an XML file for each picture file, but the filename does not match the photo (but it is close). For example, photo may be "2017-08-19 Hawaii Mauna Kea.CR2" while the XML is "2017-08-09 Mauna Kea.XML"
4. There is only one XML and one photo in each folder, but there may be ancillary files in the same sub-folders

Question: Can I rename the filename of the XML to match the photo?

The XML is the only one I have to change, but it must only be based on the photo file, and NOT any of the ancillary ones. I also have to do this for each pair in 400 folders (as a test, the main folder has 7000 more if this works).

Is this possible to do? Thanks for any assistance you can provide.
tusharbhutt
 
Posts: 3
Joined: Sun Dec 03, 2017 9:39 pm

Re: Rename XML files based on other file in subfolders

Postby tusharbhutt » Thu Dec 14, 2017 2:59 am

Is anyone able to help please?
tusharbhutt
 
Posts: 3
Joined: Sun Dec 03, 2017 9:39 pm

Re: Rename XML files based on other file in subfolders

Postby therube » Thu Dec 14, 2017 10:37 pm

(Outside of BRU...)

{pseudo-code}

Code: Select all
@ECHO OFF

ECHO  rename *.xml based upon existing picture file name
ECHO  therube 12/14/2017
ECHO.
ECHO  %1
ECHO.
FOR   %%i in (*.jpg *.cr *.cr2) do set BASENAME=%%~ni
ECHO  BASENAME:   %BASENAME%
ECHO.
PAUSE
RENAME  *.xml  "%BASENAME%".xml
DIR
pause
exit

That's my basic idea.
But you'd have to get it to iterate through your directories (& clean up the code where needed).
therube
 
Posts: 396
Joined: Mon Jan 18, 2016 6:23 pm

Re: Rename XML files based on other file in subfolders

Postby tusharbhutt » Sat Dec 16, 2017 5:31 am

therube wrote:(Outside of BRU...)

{pseudo-code}

Code: Select all
@ECHO OFF

ECHO  rename *.xml based upon existing picture file name
ECHO  therube 12/14/2017
ECHO.
ECHO  %1
ECHO.
FOR   %%i in (*.jpg *.cr *.cr2) do set BASENAME=%%~ni
ECHO  BASENAME:   %BASENAME%
ECHO.
PAUSE
RENAME  *.xml  "%BASENAME%".xml
DIR
pause
exit

That's my basic idea.
But you'd have to get it to iterate through your directories (& clean up the code where needed).


Thank you. I will give it shot in the Command console with admin rights to see how well it works.
tusharbhutt
 
Posts: 3
Joined: Sun Dec 03, 2017 9:39 pm


Return to BRU Support