Redating many RAR archives to latest file inside each RAR

You want to talk about Far Manager, but don't know where to turn?
Locked
DannyR49
Posts: 2
Joined: Sat Sep 22, 2007 12:51 am

Redating many RAR archives to latest file inside each RAR

Post by DannyR49 »

Since 1998, I've enjoyed using a batch file I created that redates many ZIP archives to the date/time stamp of the latest file from within each ZIP. Now it's RAR's chance to come to the fore!

For WinZIP command-line PkZip25.exe (15-04-98 02:50) from Pk250c32 of PKWARE Inc., there is a 'switch' (-zipdate=newest) that lets me do this nicely and reasonably elegantly.

Code snippet from my batch file:
for %%i in ("*.zip") do C:\Utils\PkZip25.exe "%%i" -silent -zipdate=newest -del nul

I simply position within the directory I wish to manipulate, then run the batch file. It's all over and done within seconds.

Pk250c32 Syntax snippet:
-zipdate - set the file modification date of the .ZIP file.

=newest - set to the date of the "newest" file within the .ZIP file.
=oldest - set to the date of the "oldest" file within the .ZIP file.
=retain - retain the original date of the .ZIP file (the date on which the .ZIP file was created).
=none - disable the .ZIP file date in the config file, and set the .ZIP date as the last modification date.
-----------------------------
=default = the current date.
default if used on command line without a sub-option = retain

Now, there's been many frustrating moments when I would have wished to do exactly the same for RAR files, rather than manually changing the current downloaded date and time backwards to the actual (latest) date/time, making it often easier to determine amongst many files which ones really are the newest.

Can someone please help me?
You do not have the required permissions to view the files attached to this post.
jonib
Posts: 70
Joined: Thu Mar 31, 2005 3:00 am
Location: Sweden

Re: Redating many RAR archives to latest file inside each RA

Post by jonib »

Hi DannyR49
DannyR49 wrote:Code snippet from my batch file:
for %%i in ("*.zip") do C:\Utils\PkZip25.exe "%%i" -silent -zipdate=newest -del nul
This seems to do what you want

Code: Select all

for %%i in ("*.rar") do C:\Utils\rar ch -tl -inul "%%i"

Code: Select all

-tl            Set archive time to latest file
-inul          Disable all messages
And you need this when not using other commands

Code: Select all

ch            Change archive parameters
Update:
But you should know that the .RAR file is modified and stuff like "authenticity verification" is removed, but your .ZIP command seems to modify the .ZIP file also.
DannyR49
Posts: 2
Joined: Sat Sep 22, 2007 12:51 am

Redating many RAR archives to latest file inside each RAR

Post by DannyR49 »

Thankyou so much JoniB. It works like a treat, no mods to do whatsoever.
I guess I was looking at UnRAR's switches, instead of getting out of the square and looking at RAR's switches.
Your extra switches to use in this mode worked perfectly - thanks again.
jonib
Posts: 70
Joined: Thu Mar 31, 2005 3:00 am
Location: Sweden

Post by jonib »

Glad it worked.
Locked