What would be the easiest way of zipping/raring/arjing a directory with a timestamp for a name?

  • And, you know, it would make a lot of sense to use a YYYYMMDD date format so the backups are listed in chronological order (and it's easy to see if the one you want is there). – pavium Dec 30 '09 at 2:37
  • @pavium - of course. – Rook Dec 30 '09 at 3:42

On the console you can do

rar a -r "backup-%DATE%.rar" "C:\Path\To\Directory"

If you also want the the time in the archive name, things get more complicated since %TIME% usually contains characters illegal for a file name (like :). To remove the colons form %TIME%, you could use some wired for-loop syntax:

FOR /F "tokens=1,2,3 delims=:" %i IN ("%TIME%") DO (
      rar a -r "backup-%DATE%-%i.%j.%k.rar" "C:\Path\To\Directory"

(See for /? for details on what this does.)

| improve this answer | |

Assuming you want a quick Explorer-based pointy-clicky solution, here's the way I'd use:

  1. First, for quick zipping, use WinZip's Add To Zip Explorer context menu option on the folder.
  2. Then, use Synesis Software's Shell Extensions Date Renamer context menu option on the resulting zip archive:

Date Renamer

I would imagine there are other solutions that are equally short but use different shell extensions.

| improve this answer | |
  • 1
    Of course, I'm curious if there's a single-step pointy-clicky solution that doesn't involve coding it oneself ;-) – Chris W. Rea Dec 30 '09 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.