Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using RARLABS RAR.exe to archive/backup my server data. I am familiar with using RAR for creating an archive and adding files from a folder, but what about streaming data directly into an archive?

For example, when backing up my MySQL databases I use the mysqldump command that includes a pipe command into a text file. It would be nice to skip the file step and go directly into an archive file using something like the following syntax:

mysqldump -uUserName -pPassword --all-databases > rar.exe newarchivename.rar

Does anyone know if what I have described, or something similar, is even possible?

share|improve this question
    
What platform? Windows/*nix? I believe you could do something with a named pipe. –  Zoredache Feb 23 '10 at 0:28
    
Yeah, it's a Windows platform... –  Dscoduc Feb 23 '10 at 6:53

2 Answers 2

up vote 5 down vote accepted

I contacted RARLabs support and recieved a response. It turns out that RAR.EXE can handle streaming input similar to how gzip works. You just need to specify the -si option:

   -si[name]
     Read data from stdin (standard input), when creating
     an archive. Optional 'name' parameter allows to specify
     a file name of compressed stdin data in the created
     archive. If this parameter is missing, the name will be
     set to 'stdin'. This switch cannot be used with -v.

Why would I want to use RAR instead of GZIP? Well one thing GZIP doesn't have is the ability to automatically include a date stamp on the file name.

So with this info here is an example of how I will be backing up the MySQL database information:

mysqldump --all-databases | rar a -siWordPressDB.sql -ag_MMMDDYYYY-HHMM WordPressDB.sql.rar

Which creates an archive file that looks similar to the following name:

WordPressDB.sql_Feb242010-0938.rar

and contains a single file:

WordPressDB.sql

Pretty cool...

share|improve this answer
    
nice, didn't know it could do that (none of my versions of rar support the -si option.. time to upgrade) –  James Feb 24 '10 at 19:07

Thanks, exactly what I'm looking for, this makes rar much more usefull.

nice, didn't know it could do that (none of my versions of rar support the -si option.. time to upgrade) – James Feb 24 at 19:07

This function is at least available since v3.71

For some reason this function isn't in the manual.
You can find this information and more in the rar.txt file.
(*nix) Usually in /usr/share/doc/rar (rar.txt or rar.txt.gz)

share|improve this answer

protected by Kara Marfia Aug 21 '10 at 4:06

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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