1

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.

  1. mkdir foldername
  2. ssh node name
  3. cd..
  4. rm filename

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.