How to set file Date/Time attributes from parts of filename

English support forum

Moderators: white, Hacker, petermad, Stefan2

User avatar
BlackWinny
Junior Member
Junior Member
Posts: 45
Joined: 2014-01-18, 16:10 UTC
Location: Close to Paris, France

How to set file Date/Time attributes from parts of filename

Post by *BlackWinny »

Hi everybody!

Is there a way (with or without TC) to modify the Date and Time attributes using elements taken from within the filename?

Let's assume I have a filename like this example : "Xenius - La fascination de l’ivoire_Arte_2019_03_29_17_08".

I would like to alter the Date and Time attributes of that file so that the Date of the file will be 2019/03/29 and the Time will be 17:08.


And subsidiary question : if this operation is in batch mode to allow the procedure for several selected files (as done by the batch renamer of TC) it would be the Heaven.


And if actually there isn't anything yet able to do this, I'd be happy to consider it as a suggestion for a future TC feature.
:D

Cheers!
Jacques
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3854
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Re: Date/Time attributes from filename

Post by *sqa_wizard »

Good news!
All this stuff is already possible, it is just a little tricky.
But once setup and saved, it helps a lot and you can use it at all selected files at once.

It is important to have the date/time always at the end of the filename.

Using the following filename as example:
Xenius - La fascination de l’ivoire_Arte_2019_03_29_17_08

Just mark the file(s) to process and open "Files - Change attributes"
Click on "More attributes"
Select "tc - writedate" and enter [=tc.fullname:-8,2].[=tc.fullname:-11,2].[=tc.fullname:-16,4]

This way you puzzled the date parts counting backwards of the filename and the digits to use
e.g. -16,4 means the year by char number 16 from the end with 4 chars

Click on "More attributes"
Select "tc - writetime" and enter [=tc.fullname:-5,2]:[=tc.fullname:-2,2]

Then press F2 and save your settings first

Finally press OK to apply the date/time to the files.

For the next runs you just have to select the files, open "Files - Change attributes" and load your settings again.
#5767 Personal license
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Date/Time attributes from filename

Post by *ghisler(Author) »

I recommend using the multi-rename tool (Ctrl+M) constructing the date from the name, because it has a preview. Once you have the right placeholders, copy them with Ctrl+C and put them in the attributes dialog as 2sqa_wizard has described.
Author of Total Commander
https://www.ghisler.com
User avatar
BlackWinny
Junior Member
Junior Member
Posts: 45
Joined: 2014-01-18, 16:10 UTC
Location: Close to Paris, France

Re: Date/Time attributes from filename

Post by *BlackWinny »

Hello to both of you and also to all the other readers !
:D

First, thanks a lot for your answers, sqa_wizard and Christian !

Thanks to your excellent explanations I have now perfectly understood the way to do.

But it seems that I have a last little issue : I systematically get an error as result, and I think that it is because I don't have the property "fullname". To check its existence I have clicked the little button "+" at the rightmost end of the line... and the property "fullname" is totally absent. For "tc" I only have "creationdate", "writedate", and "accessdate". So I think that I am missing a plugin, am I ?
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Date/Time attributes from filename

Post by *Horst.Epp »

BlackWinny wrote: 2019-03-31, 17:23 UTC Hello to both of you and also to all the other readers !
:D

First, thanks a lot for your answers, sqa_wizard and Christian !

Thanks to your excellent explanations I have now perfectly understood the way to do.

But it seems that I have a last little issue : I systematically get an error as result, and I think that it is because I don't have the property "fullname". To check its existence I have clicked the little button "+" at the rightmost end of the line... and the property "fullname" is totally absent. For "tc" I only have "creationdate", "writedate", and "accessdate". So I think that I am missing a plugin, am I ?
The tc plugin has 31 entries and the fullname is the very first in this list.
I guess you have set something into the Filter field on the bottom of the screen,
so clear this field to see the full list.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3854
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Re: Date/Time attributes from filename

Post by *sqa_wizard »

... and the property "fullname" is totally absent.
TC is a way too smart and offers only attributes directly matching to the first property (Date).
Therefore you have to enter the values manually.

This is the reason why Christian said:
I recommend using the multi-rename tool (Ctrl+M) constructing the date from the name ...
#5767 Personal license
User avatar
BlackWinny
Junior Member
Junior Member
Posts: 45
Joined: 2014-01-18, 16:10 UTC
Location: Close to Paris, France

Re: Date/Time attributes from filename

Post by *BlackWinny »

Hello Horst.Epp
:)

No, no... the Filter field is empty :

Image: http://black.winny.free.fr/Micro/TotalCommander/TotalCommander922a_ChangeAttributes_ChoosePluginProperty.jpg

And in the plugin ShellDetails the property "fullname" (or an equivalent) is absent either (in absence of the property in TC I would have taken its equivalent in this installed plugin).

Some information perhaps useful : my current version of TC is 9.22a (64-bit) and I'm registered since the version 6.51 (in 2005). And the only additional plugins that I use are Shelldetails and 7-zip.
User avatar
BlackWinny
Junior Member
Junior Member
Posts: 45
Joined: 2014-01-18, 16:10 UTC
Location: Close to Paris, France

Re: Date/Time attributes from filename

Post by *BlackWinny »

Hello sqa_wizard
sqa_wizard wrote: 2019-03-31, 17:57 UTC
... and the property "fullname" is totally absent.
TC is a way too smart and offers only attributes directly matching to the first property (Date).
Therefore you have to enter the values manually.

This is the reason why Christian said:
I recommend using the multi-rename tool (Ctrl+M) constructing the date from the name ...

So I would have to use "[N-8-7].[N-11-10].[N-16-13]" directly as is (without the double quotes of course), without changing the "N" occurrences ?

I have also tried "[N:-8,2].[N:-11,2].[N:-16,4]" with the same punition as result.
:)

OOOooommmmm...
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3854
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Re: Date/Time attributes from filename

Post by *sqa_wizard »

The different notations results on the option you set at MRT by choosing "N#-# Range" button.
[N-8-7] is the result of choosing first option
[N:-8,2] is the result of choosing third option

Fortunately all of them work :)
#5767 Personal license
User avatar
BlackWinny
Junior Member
Junior Member
Posts: 45
Joined: 2014-01-18, 16:10 UTC
Location: Close to Paris, France

Re: Date/Time attributes from filename

Post by *BlackWinny »

But in the Attribute dialog :
  • Do I have to use N ? (the letter N)
  • Or do I have to use tc.fullname ? (the string tc.fullname)

It is a point that I'm troubled on.


For the renaming of the filenames (with Ctrl+M), it's been years that I use the variables. So, no problem for them. And I understand that the way to use the offsets in these strings are the same on the Attribute dialog box. No problem for that.
:)

My trouble is with the Attribute changing dialog which doesn't understand the syntax despite the copy/paste.

About Horst.Epp's contribution, it's now ok with the addition from Christian telling that TC is a bit too smart. So yes, if I let the property to change on "comment" I can see all the properties. So Ok, I leave the list not used and I write directly in the field.

So:
  1. I select the file Xenius - La fascination de l’ivoire_Arte_2019_03_29_17_08.mp4.
  2. I open the Attributes dialog box.
  3. At the second half of the dialog box, I select "writedate" as property name ("tc" is already selected by default as plugin name).
  4. Automatically the checkbox "Change plugin attributes" is now ticked.
  5. I strike "[=tc.fullname:-8,2].[=tc.fullname:-11,2].[=tc.fullname:-16,4]" (without the double quotes) in the text field (in fact as precaution I do a copy/paste, and as you can see there seems to be no error in my syntax).
  6. And finally I click OK (for the moment, being in my first experimentation before going further).
And... the result is an alert box containing :
Error setting the following attribute:
writedate

Continue ?
So of course after I click Yes the attribute isn't changed.
8)
Last edited by BlackWinny on 2019-03-31, 21:19 UTC, edited 4 times in total.
User avatar
BlackWinny
Junior Member
Junior Member
Posts: 45
Joined: 2014-01-18, 16:10 UTC
Location: Close to Paris, France

Re: Date/Time attributes from filename

Post by *BlackWinny »

Christian,

On my computer the date separator and the time separator are both set on "-" on the OS instead of the common separators (it is an obligation to make work a special scientific program, so I'm constraint to use this separator for the dates and times).

Could it be the cause of my trouble ?
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Date/Time attributes from filename

Post by *petermad »

2BlackWinny
What is the format of your systems date? "[=tc.fullname:-8,2].[=tc.fullname:-11,2].[=tc.fullname:-16,4]" is meant for a system using DMY (Day, Month, Year).

If your system is using YMD - then you should use: "[=tc.fullname:-16,4].[=tc.fullname:-11,2].[=tc.fullname:-8,2]"
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
BlackWinny
Junior Member
Junior Member
Posts: 45
Joined: 2014-01-18, 16:10 UTC
Location: Close to Paris, France

Re: Date/Time attributes from filename

Post by *BlackWinny »

petermad wrote: 2019-04-01, 01:12 UTC 2BlackWinny
What is the format of your systems date? "[=tc.fullname:-8,2].[=tc.fullname:-11,2].[=tc.fullname:-16,4]" is meant for a system using DMY (Day, Month, Year).

If your system is using YMD - then you should use: "[=tc.fullname:-16,4].[=tc.fullname:-11,2].[=tc.fullname:-8,2]"
Bingo !!!

Image: http://hsjp.eu/smileys/6incr/Incr_Gen_284.gif

You found the real cause of all that ! I didn't despair but I was far from searching in this direction.

Thank you ! Thank you ! Thank you ! Peter you saved my life because I have more than 600 documentaries to change that way !
Image: http://hsjp.eu/smileys/6incr/Incr_Gen_093.gif

And thanks also to sqa_wizard, to Horst.Epp, and to Christian for their helps !

I'm gonna do now the writetime, way easier, then I can go to the next step : saving with F2 and mainly change these attributes for many files at once.

Have a nice week, friends !
:D
User avatar
BlackWinny
Junior Member
Junior Member
Posts: 45
Joined: 2014-01-18, 16:10 UTC
Location: Close to Paris, France

Re: Date/Time attributes from filename

Post by *BlackWinny »

Correction : in fact it is not the property "fullname" which must be taken... but only the property "name". So without the extension (and it makes sense, of course).

All the rest you all wrote is excellent.
:D
JensusUT
Junior Member
Junior Member
Posts: 11
Joined: 2004-09-04, 21:06 UTC

Re: Date/Time attributes from filename

Post by *JensusUT »

ghisler(Author) wrote: 2019-03-31, 06:50 UTC I recommend using the multi-rename tool (Ctrl+M) constructing the date from the name, because it has a preview.
Hi all,

Let me "mis"-use this thread: From previous discussions I tried the multi-rename-string
[=tc.Name:7-8].[=tc.Name:5-6].[=tc.Name:1-4] [=tc.Name:9-10]:[=tc.Name:11-12]:[=tc.Name:13-14]

to set the file-date according to the name, preview in multi-rename-tool.
Image: https://ibb.co/0nMT1dT

But as soon as I add the first colon to separate hours and minutes ([=tc.Name:9-10]:[=tc.Name:11-12]) I get an error
Image: https://ibb.co/C8BczQY

Where's the fault?
FYI, I'm using 9.50ß10.

Kind regards, thanks and a nice day,

Jensus
Post Reply