Alter.Org.UA  
 << Back Home RU ru   Donate Donate www/www1/www2

Repack RAR->TGZ in Far (via User Menu)



A small macro and bat-file for repacking RAR-archives to TGZ from Far's UserMenu. It requires PATH environment variable to point to location of rar.exe tar.exe and gzip.exe. It also requires deltree.exe unility.

New version contains error checking. It was added when I called repack standing on ".." folder ;) As result the whole contents of the folder was erased. I had to use EasyRecovery...

Unfortunately, Far doesn't support coonditiona execution and jumps in macros. Thus, all functionality was moved to separate bat-file.

Macro sequence is absolutely simple:

rar2tgz.bat "!" "!.rar" "!.tar" "!.tgz"

bat-file is simple too:

@rem %1 - "!", %2 - "!.!", %3 - "!.tar", %4 - "!.tgz"
@echo repack %2

@rem build tmp directory
if exist $tmp_repack_rar2tgz.tmp goto quit
mkdir $tmp_repack_rar2tgz.tmp
if not exist $tmp_repack_rar2tgz.tmp goto quit
copy %2 $tmp_repack_rar2tgz.tmp
cd $tmp_repack_rar2tgz.tmp

@rem check for ".." and "."
if exist %1 goto quit2

mkdir %1
if not errorlevel 0 goto quit2
if not exist %2 goto quit2
rar.exe x %2 %1
if not errorlevel 0 goto quit2
tar.exe -f %3 -c %1
gzip.exe -9 %3 -c > %4
copy %4 ..

:quit2

cd ..
deltree.exe $tmp_repack_rar2tgz.tmp

:quit

It is possible to install it by importing rar-tgz.reg from. rar-tgz_v2.rar/tgz (499 bytes/556 bytes). The archive also contains rar2tgz.bat, that does all work. Note, you will need to change 666 number in rar-tgz.reg in Key named Item666 for the first unused value (see Registry, HKEY_CURRENT_USER\Software\Far\UserMenu\MainMenu).

2004.02.05

An old version of small macro (without any erro checks):

mkdir "!"
rar.exe x "!.!" "!"
tar.exe -f "!.tar" -c "!"
gzip.exe -9 "!.tar" -c > "!.tgz"
del "!.tar"
deltree.exe "!\!"

It is possible to install it by importing rar-tgz.reg. But you will need to change 666 number in Key name Item666 for the first unused value (see Registry, HKEY_CURRENT_USER\Software\Far\UserMenu\MainMenu).


2003.10.21


designed by Alter aka Alexander A. Telyatnikov powered by Apache+PHP under FBSD © 2002-2017