Need a little help renaming and moving .mt2s and .modd files

Started by Malakai, January 13, 2013, 09:41:33 AM

Previous topic - Next topic

Malakai

Hey guys, hope someone can help.

I Import my videos to an import folder, each video file consists of an ***.mt2s and ***.modd file.
The full filenames are the date and time backwards.

Im using the following command to rename the .mt2s to a easy forward date time, create a folder in the Videos directory based on the date and move it there for easy search and ease of use.

exiftool -r "-FileName<${DateTimeOriginal}" -d %%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e -ext .m2ts N:\Media\Import\ $"-Directory<DateTimeOriginal" -d N:\Media\import\\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e -ext .m2ts  N:\Media\Videos\


This works perfectly.
The problem i have is that i need the accompanying .modd file to be renamed to the same name as the video (.mt2s file) and be moved into the same folder. Is this in any way possible?

Im running windows and using a .bat file to execute the previous command.

Thanks all.

Malakai

Ok, i spotted this post from a few years ago https://exiftool.org/forum/index.php/topic,3549.msg16119.html#msg16119 but cant seem to tailor it to make it do what its intended for me. I dont know enough i guess. Phil, if you could tailor the code in that post to work for me that would be incredible.

Basically my file sync program executes the .bat file to rename and organise content from the import folder into their respective folders based on datetime stamps. Once the bat finishes the file sync program then duplicates the main photo and video folders on both offsite and onsite storage for backup purposes.

this is the full .bat code im using.

echo off
exiftool -r "-FileName<${DateTimeOriginal}" -d %%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e -ext .JPG N:\Media\Import\ $"-Directory<DateTimeOriginal" -d N:\Media\Photos\\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e -ext .JPG  N:\Media\Import\
exiftool -r "-FileName<${DateTimeOriginal}" -d %%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e -ext .mpo N:\Media\Import\ $"-Directory<DateTimeOriginal" -d N:\Media\3D\\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e -ext .mpo  N:\Media\Import\
exiftool -r "-FileName<${DateTimeOriginal}" -d %%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e -ext .cr2 N:\Media\Import\ $"-Directory<DateTimeOriginal" -d N:\Media\Raw\\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e -ext .cr2  N:\Media\Import\

for /f "usebackq delims=" %%d in (`"dir N:\Media\Import\ /ad/b/s | sort /R"`) do rd "%%d"


This code renames, moves and then deletes old folders in the import folder.


Hope this helps out.

Mal

Phil Harvey

Hi Mal,

I have a few comments:

1) I don't understand the "$" before "-Directory..." in your command.

2) I don't think that your command is doing what you thought.  The -d option applies to the entire command, so there may be only one -d option per command.  Also, your command was processing the same directory twice with the same arguments.  But you can write the directory and file name together through the FileName tag.  So I think the command should be:

exiftool -r "-FileName<DateTimeOriginal" -ext .m2ts N:\Media\Import\ -d N:\Media\import\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e

3) Your situation is simpler than the other thread you referenced because you aren't testing to see if the Make is "Sony" before copying the files.  So to copy the .modd files, you can just do this:

exiftool -r -tagsfromfile %%d%%f.m2ts "-FileName<DateTimeOriginal" -ext .modd N:\Media\Import\ -d N:\Media\import\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.modd

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Malakai

Thanks for the fast reply Phil, the first bit of code works great but ive just noticed the .modd files are e.g. 20131301194712.MTS.modd
for some reason that extra .mts in the filename is stopping it working.

Phil Harvey

Are you telling me that the file names look like this before you run ExifTool?:

N:\Media\Import\20131301194712.M2TS
N:\Media\Import\20131301194712.MTS.modd

Odd.  But in this case all you need to do is to use %%-.4f instead of %%f to ignore the last 4 characters in the -tagsfromfile file name.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Malakai

Thanks Phil. Before you gave a reply i managed to come up with fully working code. Ill paste it here for others should they want to use it or if it can be streamlined.

@echo off

exiftool -r "-FileName<DateTimeOriginal" -ext .jpg N:\Media\Import\ -d N:\Media\Photos\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e
for /f "usebackq delims=" %%d in (`"dir N:\Media\Import\ /ad/b/s | sort /R"`) do rd "%%d"


exiftool -r "-FileName<DateTimeOriginal" -ext .cr2 N:\Media\Import\ -d N:\Media\RAW\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e
for /f "usebackq delims=" %%d in (`"dir N:\Media\Import\ /ad/b/s | sort /R"`) do rd "%%d"


exiftool -r "-FileName<DateTimeOriginal" -ext .mpo N:\Media\Import\ -d N:\Media\3D\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e
for /f "usebackq delims=" %%d in (`"dir N:\Media\Import\ /ad/b/s | sort /R"`) do rd "%%d"


exiftool -r -tagsfromfile %%d%%f "-FileName<MediaCreateDate" -ext .modd N:\Media\Import\ -d N:\Media\Videos\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.modd
exiftool -r "-FileName<MediaCreateDate" -ext .mp4 N:\Media\Import\ -d N:\Media\Videos\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e
for /f "usebackq delims=" %%d in (`"dir N:\Media\Import\ /ad/b/s | sort /R"`) do rd "%%d"


exiftool -r -tagsfromfile %%d%%f "-FileName<DateTimeOriginal" -ext .modd N:\Media\Import\ -d N:\Media\Videos\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.modd
exiftool -r -tagsfromfile %%d%%f "-FileName<DateTimeOriginal" -ext .moff N:\Media\Import\ -d N:\Media\Videos\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.moff
exiftool -r -tagsfromfile %%d%%f "-FileName<MediaCreateDate" -ext .modd N:\Media\Import\ -d N:\Media\Videos\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.modd
exiftool -r -tagsfromfile %%d%%f "-FileName<MediaCreateDate" -ext .moff N:\Media\Import\ -d N:\Media\Videos\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.moff
exiftool -r "-FileName<DateTimeOriginal" -ext .MTS N:\Media\Import\ -d N:\Media\Videos\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e
exiftool -r "-FileName<DateTimeOriginal" -ext .M2TS N:\Media\Import\ -d N:\Media\Videos\%%Y-%%m-%%d\%%Y-%%m-%%d" "%%H.%%M.%%S%%%%-c.%%%%e
for /f "usebackq delims=" %%d in (`"dir N:\Media\Import\ /ad/b/s | sort /R"`) do rd "%%d"



I know there are a lot of empty folder delete requests in there, i put them in because sometimes there are just photo folders and no video folders so to speed up checking of empty folders i made it del them after each file type import.

Thanks again Phil. Superstar.

Mal