GP SoftwareTwitter
Opus FAQsManualCommandsObjects

RAR a folder with script

Dear friends,
I need your help once again!
I currently use the following command

Copy ARCHIVE=.rar CREATEFOLDER="{file$|noext} - {date|yyyy-MM-dd} {time|HH-mm-ss}" HERE 

to create a backup of a folder with a timestamp.This command is on the file types context menu.

I would like to add one more step and log the backup timestamp into a filename called "backup.txt" inside the folder.
I understood that I have to mix command with script and then I stacked!

Also I would like to ask if there is a compression level parameter for rar files. I noticed that my backups are quite big compared with best compression result directly with rar.

Any ideas / suggestions are more than welcome as always.

Thank you in advance!


You might not need a script for this, unless you want something complicated in the backup.txt file.

Set the Function drop-down to MS-DOS Batch Function, then use this:

@runmode hide
cd {sourcepath}
Copy ARCHIVE=.rar CREATEFOLDER="{file$|noext} - {date|yyyy-MM-dd} {time|HH-mm-ss}" HERE 
echo {date|yyyy-MM-dd} {time|HH-mm-ss}>>backup.txt

RAR compression level can be configured under Preferences / Zip & Other Archives / Archive and VFS Plugins.

This is exactly what I would like to do!
I didn't know the MS-DOS Batch Function.
This program always amazes me!
There are so many cool cool features!!!
Thank you!


DOS Batch isn't something I'd recommend often these days. You're usually better off using JScript or VBscript. But if you only need to append something simple to a text file, that's one of the few things where DOS Batch is a bit easier than the scripting route (as long as you don't care about unicode, etc., which DOS Batch is not good for).

Hi Leo,
One small detail is missing!
I need the file backup.txt to be inside the folder that is compressed.
Can I achieve this with DOpus variables?


Tidied up some other things as well:

@runmode hide
@set timestamp={date|yyyy-MM-dd} {time|HH-mm-ss}
cd {sourcepath}
echo {$timestamp}>>"{file$|noext}\backup.txt"
Copy ARCHIVE=.rar CREATEFOLDER="{file$|noext} - {$timestamp}" HERE 

Well done Leo!
Thank you once more!