Is it possible to stream input into RAR

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?


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...