Hi All,
I am new to ruby and i am trying to Copy files from Some other location
to the Current Working Directory. I am using Ruby 1.8.6. Please let me
know what i can do for this? Thanks All…
Hi All,
I am new to ruby and i am trying to Copy files from Some other location
to the Current Working Directory. I am using Ruby 1.8.6. Please let me
know what i can do for this? Thanks All…
Copying files can be done using the standard module FileUtils:
The current working directory can be written as ‘.’, or, if you prefer,
you can use FileUtils.getwd. It’s just a matter of taste.
Ronald F. wrote in post #1183899:
Copying files can be done using the standard module FileUtils:
The current working directory can be written as ‘.’, or, if you prefer,
you can use FileUtils.getwd. It’s just a matter of taste.
Hi Ronald,
Thanks for the Support. I have a question regarding copy of files.
What will be the return type of FileUtils_cp_r. If suppose the copy of
the files is success what will it return and if its a Failure what will
it return?
I have done something like below, in order to check this, when the copy
is performed i am seeing a value “NULL” otherwise an error message.
Result = FileUtils.cp_r(SRC_Folder, Dest_older)
puts Result
Sai Sankar wrote in post #1183914:
Ronald F. wrote in post #1183899:
What will be the return type of FileUtils_cp_r. If suppose the copy of
the files is success what will it return and if its a Failure what will
it return?
No, they throw an exception on error. I don’t think the return value is
of any use.
I darkly remember that all FileUtils functions signal failure with an
exception. The documentation is not very clear in this case. You can try
it from irb, for example by specifying a non existing source file.
Ronald
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs