organising mts files into their own date directories

Started by Smokeyone, February 07, 2017, 06:17:46 AM

Previous topic - Next topic

Smokeyone

Hello
I am brand new to Exiftool and almost new to using the command line in Ubuntu.
After years of backing up hundreds of mts files together with back ups of backs I thought it was time to sort them out so I decided the best way was to name them by their date created.
After searching the web I found Exiftool which will do the job nicely. I read the documents, searched the forum and after many attempts with incorrect formatting i came up with this -

exiftool -ext mts ext MTS  "-FileName<DateTimeOriginal" -d "%Y%m%d_%H%M%S.%%le"  40.MTS

Just to change one test mts file on my desktop to a date/time title

Then amended it to this

exiftool -ext mts ext MTS   "-FileName<DateTimeOriginal" -d "%Y%m%d.%H:%M:%S.%%le" testonly

To change all the titles in a desktop directory. Along the way I found out that you need ext mts ext MTS in upper and lower case otherwise only one or other are chosen and also
%le makes all mts results lower case.

Please could someone assist with how to reorganise the mts files into their own directories with a day date like this example  20170207

I haven't asked about duplicate files !

Many thanks

Phil Harvey

Quote from: Smokeyone on February 07, 2017, 06:17:46 AM
To change all the titles in a desktop directory. Along the way I found out that you need ext mts ext MTS in upper and lower case otherwise only one or other are chosen

I think you must be wrong about this.  The ExifTool -ext option is not case sensitive.  (Note that you forgot a "-" before your second -ext in the command you posted, but I think that is unrelated.)

QuotePlease could someone assist with how to reorganise the mts files into their own directories with a day date like this example  20170207

The command could be:

exiftool -ext mts  "-FileName<DateTimeOriginal" -d "%Y%m%d/%Y%m%d_%H%M%S%%-c.%%le" DIR

This will create the new directories in the current directory, but you can add a path at the start of the format string to put them anywhere you want.

I have also added "%%-c" to the format to add a copy number for the case where there are two files with the same date/time.

- 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 ($).

Smokeyone

Hello Phil

Thank you for your help - I tried your suggestion in the Terminal and keep getting the error message File not found -

This is exactly what I pasted in - my existing test folder is called    testonly1

exiftool -ext mts "-testonly1<DateTimeOriginal" -d "%Y%m%d/%Y%m%d_%H%M%S%%-c.%%le" DIR

I understand about Exiftool not being case sensitive - my fault - I included upper & lower case to cover different files with both upper & lower case

Thanks again

Phil Harvey

You should have seen this error message:

File not found: DIR
You were meant to enter any valid directory name, not "DIR" literally.


If so, that was a clue for you.  Also, my signature is another clue.

- 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 ($).

Smokeyone

Sorry, my misunderstanding - I thought DIR meant ithe command line was going to create dated directories on the desktop for the files to go in -

Smokeyone

Update -

Is this the correct format - I think it works fine ....

exiftool -ext mts  "-FileName<DateTimeOriginal" -d "%Y%m%d/%Y%m%d_%H%M%S%%-c.%%le" testonly1

Thank you for your patience ...