Change date/time getting values from filename

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
zupermario
Junior Member
Junior Member
Posts: 37
Joined: 2011-04-01, 21:11 UTC

Change date/time getting values from filename

Post by *zupermario »

Hello,
i have several files named:

abcd_year_month_day_hh_mm_ss.txt
ghedfdwdwe__year_month_day_hh_mm_ss.txt
xxxxx_year_month_day_hh_mm_ss.txt
urca_year_month_day_hh_mm_ss.txt

I'm looking for a method to change date/time of every file getting values from "year_month_day_hh_mm_ss" part of file name. It's possible with TC?

Thanks.

P.S.: i also need to change my profile's email on this forum...
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Take a look at that posts:
selecting the files in the normal file window (not MRT)
and goto Menu "File" -> "change attributes"

In the bottom you can select to use plugins to change attributes.
Use Plugin: TC
Use Property: Writedate (or any other date)
Value: [=tc.fullname:9-10]-[=tc.fullname:6-8][=tc.fullname:1-4] [=tc.fullname:15-16].[=tc.fullname:18-19].[=tc.fullname:21-22]
Adopt that syntax to match the parts in your file name pattern "abcd_year_month_day_hh_mm_ss.txt"


http://ghisler.ch/board/viewtopic.php?t=33512&highlight=date+filename

http://ghisler.ch/board/viewtopic.php?t=39466&highlight=date+filename

http://ghisler.ch/board/viewtopic.php?t=15794&highlight=date+filename

and some more....



 
zupermario
Junior Member
Junior Member
Posts: 37
Joined: 2011-04-01, 21:11 UTC

Post by *zupermario »

Stefan2 wrote:Take a look at that posts: 
LOL I forgot to thank you, so thank you now :D
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Thx, glad you sorted it out.




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

Regrets

Post by *Phred »

This does seem to be a difficult way of configuring a file: counting characters and testing success, then doing it again for the second section; testing, repeating; testing, repeating..
It reminds me of pushing out chads in punch cards with a paper clip, counting the columns, pushing, counting... inserting the stack in a reader and tesing the batch. That's many years ago.

We do have a GUI to work with these days, thank The Fates. A GUI, or a VMU - a Visual Method of Use.
Is there no way that we can select ranges of a filename *visually* to compose an expression? The Multi-rename Tool has the facility; nothing for Change Attributes?
Anything other than this chisel and stone method would be better, IMHO :(
TC showing its VMU age..

[PS Change your email address in your Profile, zupermario. Notifications to my Yahoo address never got to me, so be careful.]
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Use 'Multi-rename Tool' for 'Change Attributes' expression

Post by *Stefan2 »

Phred wrote: Is there no way that we can select ranges of a filename *visually* to compose an expression? The Multi-rename Tool has the facility; nothing for Change Attributes?
The trick here is to utilize first the 'Multi-rename Tool'

to compose the expression,

then copy & paste the expression string to the 'Change Attributes' dialog.




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

Egad

Post by *Phred »

Hmm.

This is part of my hand-crafted 'scratch-pad' in the MrT:

[N25-28]-[N22-23]-[N19-20]+[=tc.fullname:25-28]
A work in progress.
For the file 30-the-uk-report--30-05-2016.mp3

So I walk into the workshop next door, configure the lathe and the cutting tool for the work there; trial it, then detach the tool and return to the workshop I came from and plug it in there.
Then do the work.
:roll:

Less than ideal in 2016.

(Have you looked at the TC home page lately; there's a reference to October, 2006 there... And TC CE/Pocket :shock: )
Phred
Senior Member
Senior Member
Posts: 382
Joined: 2009-06-16, 15:24 UTC
Location: SEAu

Try This

Post by *Phred »

.
WORKING EXAMPLE

To re-date-&-time the file:
13-queen's-birthday-honours--greg sheridan.mp3
..to the date the podcast was published, rather than downloaded, the 13th June '16, in the logical EU/AU/JP small-bigger-biggest date format, at 10:12 p.m., use this:

File | Change attributes; tick Change plugin attributes,
Plugin: tc, Property: writedate, [=tc.name:1-2]/06/2016
+ (more attributes)
Plugin: tc, Property: writetime, 22:22:00
OK

Mutatis mutandis; change format according to taste.

In words, the leading two characters ('[=tc.name:1-2]') of the filename are being taken to change the file's date attribute; the date Windows shows the file as arriving/being last written/saved.
To those first two characters is added the rest of the date: /06/2016 - in the exact, current, date format TC is displaying.
The full Value of the Property writedate becomes: [=tc.name:1-2]/06/2016

At the same time, the last time written/saved can be changed to 10:22 p.m. with the Value 22:22:00

Press OK to complete and thereby change the date/time attributes from the information in the filename.
TC sets the file's date to 13/06/2016 and its time to 22:22.
QED
Post Reply