Arsip Tag: rar

Use WinRAR rar.exe console to compress DEMNAS GeoTIFF files

if you’ve download DEMNAS from BIG, you’ll realise that those files are NOT EVEN compressed, pure bitmap raw files … I’m not sure why BIG didn’t DEFLATE those files before distributing them … but, they only 140 GB … and if you using mobile plan to download it … ONLY cost you IDR 1,2 million… CHEAP for majority of Geo-enthusiasts and students in Indonesia … as long as there are no interruptions whilst you download it … I’ve been struggle re-download it again with newer download.php mechanism who I think too SMART … can’t even resume the download … thank BIG for that … I’ve swear a lot…

Ok … now let’s back to the topics of this blog …

If you’ve downloaded all those DEMNAS files, best way to resize those files when you’re using Ms Windows is by compressing it. I love to compress files with tar -czvf commands in linux … but in MS Windows, we have rar.exe

best switch for rar.exe are -m5 -s to create BEST,SMALLEST archive possible (-m5) and solid (-s). Solid means that all files are combined and re-compress it again. Longer (couple of milliseconds) but worth compression.

so, to compress demnas.tif file into demnas.rar you can use this following command in your CMD.exe

rar a -m5 -s -df DEMNAS_2912-24_v1.0.rar DEMNAS_2912-24_v1.0.tif

additional -df switch is to delete old source non compressed files after compressing done…

trouble shooting …

What if you cant call rar.exe from CMD.exe?

you got error ‘rar’ is not recognized as an internal or external command …

well …. you need to include winrar folder into your PATH … type following code into your CMD prior to calling that rar.exe

set PATH="C:\Program Files (x86)\WinRAR";%PATH%

I have plenty of DEMNAS files, should I type it one by one?

if you want to script it … my best way is to list all those files and put it on single file out.cmd

dir /b *.tif out.cmd

you’ll have a single out.cmd file which lists all of TIF files within current directory

What next?

Open this file with Notepad++

Ctrl+H to open replace pop-up using regex … in Notepad++

find what

^(DEMNAS.*).tif

replace with

rar a -m5 -s -df $1.rar $0
2019-02-27_11-06-44-regex MAKE SURE YOU SELECT radio button Regular expression instead of Normal search mode (default)

this regular expression will find all line which starting (^) with DEMNAS .* whatever and have .tif at somewhere within current line.

$1 is any string WITHIN bracket on find string .. in my case it’s DEMNASwhatever

$0 is whole find string … in this case is DEMNASwhatever.tif

Notepad++ and CMD in actions…

I’ve add set PATH command at line #1 in my cmd file…

REM is for commenting / REMARK … in cmd file

What you’ve been done?

Original DEMNAS papua 3,8 Gigabyte on first DVD is became 700 MB only … worth compression …

RIP English

F U


Iklan