LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   [Ruby] Tar'ing or Zip'ing with ruby script (https://www.linuxquestions.org/questions/programming-9/%5Bruby%5D-taring-or-ziping-with-ruby-script-520696/)

lmcilwain 01-18-2007 08:00 PM

[Ruby] Tar'ing or Zip'ing with ruby script
 
Is there anyway to pass shell commands through ruby script?

I want to be able to tar or zip files but don't want to have to create a separate script to do this and then have ruby finish the rest of the job.

Is there a way that I can insert a tar or zip command inside of my ruby script?

taylor_venable 01-19-2007 06:29 PM

Hi, sorry this is somewhat late.

The Zlib module (part of the standard library) has support for zip and gzip handling of files: http://www.ruby-doc.org/stdlib/libdo...doc/index.html

Also, the Kernel module has a method "system(cmd, [args]*)" that executes a command in a subshell: http://www.ruby-doc.org/core/classes/Kernel.html

Edit: Yay! This is my (expt 2 9)th post!

lmcilwain 01-19-2007 06:56 PM

Thanks for the reply, I will give it a shot...


All times are GMT -5. The time now is 11:16 PM.