Reputation: 979
I am new to ruby. :)
I am trying to run windows command (mkdir, cd..) using ruby script. I know this will be very simple using shell scripting. But I want to try doing it with ruby, is there a way I can do it?
eg.
Upvotes: 1
Views: 85
Reputation: 118299
Look into the stdlib FileUtils
.
Just require this lib by using the line require 'fileutils'
, and get access to all the methods of this lib and use those as per your need.
mkdir foldername
can be written as :
FileUtils.mkdir foldername
cd..
can be written as :
FileUtils.cd('..')
rm filename
can be written as :
FileUtils.rm filename
Install the gem net-ssh
to do such operations ssh node name
.
Upvotes: 1