Setting file date based on file name

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Partial
Junior Member
Junior Member
Posts: 25
Joined: 2009-09-08, 07:27 UTC

Setting file date based on file name

Post by *Partial »

I could not find it or this feature is not available?

Is it possible to change file attributes, specifically created/modified date based on a string in file name?

I have a lot of files with different naming patterns, such as:

(2013-01-10) insurance.pdf
(2017-05-15) parcel delivery.pdf
etc.

All these files have same date, e.g. today.

I need to rename them removing first part "(2013-01-10)" and set file date attribute accordingly to 2013.01.10 and 2017.05.15, so that final list is:

insurance.pdf
parcel delivery.pdf

with respective file date.

Is it possible to make it through some features in TC or I have to use third-party utility?

I just thought it would be more natural to make right inside TC, because multi-rename tool and file attribute changing are already there.
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

See f.ex.: https://www.ghisler.ch/board/viewtopic.php?p=279009#279009


There's the File -> Change Attributes function :

Use Plugin: TC
Use Property: Writedate (or any other date)
Value: [=tc.fullname:2-5] [=tc.fullname:7-8].[=tc.fullname:10-11]

You need to provide the date/time in the same format as it is displayed when you click on "Load from file under cursor".


So play with the numbers behind 'tc.fullname:'...
Open MultiRenameTool, press F1-key and read more about that syntax.


- - -

Next step is to remove the numbers from the filename with MRT.
But that is another story / thread (and can be found in forum too) Later more...



 
User avatar
Phred
Senior Member
Senior Member
Posts: 375
Joined: 2009-06-16, 15:24 UTC
Location: SEAu

Attribs, Names

Post by *Phred »

In fact, Partial, there's very little visual help with the Change Attributes function in TC, so it's a bit of a guessing game.

Stephan2 has given you (almost) a way of redating your files if your system is using the yyyy.mm.dd date format. (He's missed a . between the first and second [ ] blocks.)

I would be using [=tc.fullname:10-11]/[=tc.fullname:7-8]/[=tc.fullname:2-8] for the logical dd/mm/yyyy format we use here.

After performing this action, you'll have a file:
(2013-01-10) insurance.pdf ...with date/time... 2013.01.10 00:00

...if that's how you display files' dates and times.

Maddeningly, this re-attributing zeroes the time. The writedate attribute field should really be called writedate&time because date and time are integrated.
You fix this by adding (a space first)[=tc.writetime] in the Value field. This maintains the existing writetime.

In summary:
File, Change attributes
Change plugin attributes
[choose More attributes]
Plugin: TC
Property: writedate
Value: [=tc.fullname:2-5].[=tc.fullname:7-8].[=tc.fullname:10-11] [=tc.writetime]
...as per Stephan2's example (note the space before the writetime block).
OK

No visual cues, so good luck :)

Renaming is fairly simple: use the Multi-Rename Tool (Ctrl+M) with selected files, then in the first field put the range [N14-99] (for charas beyond the first 13 charas to the, say, 99th) or even more simply [N14-] (14th chara to the end) and you'll see, visually, what you'll get: the prefixing dates truncated from the filenames.
Choose Start!

HTH
Regards, PhredE
Licence holder since 1999
Awaiting a $D donors-token for the title-bar so we can display that we have donated further.
Post Reply