pack files with timestamp

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
jeremycod
Junior Member
Junior Member
Posts: 4
Joined: 2009-01-29, 18:03 UTC

pack files with timestamp

Post by *jeremycod »

Hi,

I have to archive my project very often and it is very useful if I have timestamp information (date and time) in filename like "myproject_2009_01_29_19_45.rar". Its tedious to add this information manually each time. Is it possible to automatise this process?
It is not important which archiver is used.

Thanks
Zoran
User avatar
theosdikaios
Senior Member
Senior Member
Posts: 228
Joined: 2006-02-04, 13:02 UTC

Post by *theosdikaios »

IIRC there is no feature in Total Commander for your task. I made a button with help of cmd.exe feature of %date%. Because the format of %date% depends on your country settings maybe you need to change my example.
%date% gives me "dd/mm/yyyy"
My example produce a zip file "yymmdd.zip"
%Date:~3,2% returns "mm" (after 3rd position 2 letters)

You can do it with %time% in a similar way.

Code: Select all

TOTALCMD#BAR#DATA
cmd /c start %ProgramFiles%\WinRAR\WinRAR.exe a %Date:~-2,2%%Date:~3,2%%Date:~0,2%.ZIP
@%L
%ProgramFiles%\WinRAR\WinRAR.exe
Pack marked files into yymmdd.zip


-1
EDIT: There is another thread about this topic
Does TC have Date Parameter
"Since there are many things which have never happened and never will happen,
and which nevertheless are clearly conceivable, and imply no contradiction,
how can one say they are absolutely impossible?" Leibniz
jeremycod
Junior Member
Junior Member
Posts: 4
Joined: 2009-01-29, 18:03 UTC

Post by *jeremycod »

It sounds like a good idea, but I'm not sure what should I do with the code you have provided. I have tried to create a submenu item, but I was not sure which part of the code belongs to specific fields that should be provided. Could you give me some more details how to make this work?
It is also possible to make this with some other tool, like WinRar or WinZip if it already exists there.

Thanks
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

You can use MRT.
jeremycod
Junior Member
Junior Member
Posts: 4
Joined: 2009-01-29, 18:03 UTC

Post by *jeremycod »

You can use MRT.
This solves problem, but in one more step. It would be much better if I can do it in one step like suggested by theosdikaios.
User avatar
norfie²
Power Member
Power Member
Posts: 1041
Joined: 2006-02-10, 07:27 UTC

Post by *norfie² »

2jeremycod
how to make this work?
The code is the clipboard content of a TCmd-button. Mark the whole content of the "code" and copy to clipboard (CTRL+C). Then a right click in Tcmd button bar choose "Paste". Now you should have got a new button.
It is also possible to make this with some other tool, like WinRar or WinZip if it already exists there
Thats the simpliest way e.g. using WinRAR switch "-ag". Do you need a free WinRAR licence? If so, search for "winrar free licence"?
jeremycod
Junior Member
Junior Member
Posts: 4
Joined: 2009-01-29, 18:03 UTC

Post by *jeremycod »

It is also possible to make this with some other tool, like WinRar or WinZip if it already exists there
Thats the simpliest way e.g. using WinRAR switch "-ag". Do you need a free WinRAR licence? If so, search for "winrar free licence"?
Thank you norfie. When thying to resolve how to use switches in WinRAR I found that it is possible to setup backup to add datetime stamp as default, so it adds it each time I make an archive with WinRAR. It's works for me.

Thank you all for help.
User avatar
Wojtek
Junior Member
Junior Member
Posts: 72
Joined: 2010-02-07, 11:58 UTC
Location: Germany

Post by *Wojtek »

Hi,

more than five years have passed now...

Is there any other way then using CMD? A plugin maybe?

Thanks.
Post Reply