Following is the example to rename an existing file test1 txt usr bin ruby rename a file from test1 txt to test2 txt file rename test1 txt test2 txt following is the example to delete an existing file.
Ruby delete file.
Here is the process in detail.
The following tutorial describe how to delete files and directories that you no longer need in your application.
Use the file class to open a file.
For pokemon omega ruby on the 3ds a gamefaqs message board topic titled how to delete a save file.
Rm r site ruby mylib force.
Open the file with the open method.
Renaming and deleting files.
Close the file with the close method.
Read the file the whole file line by line or a specific amount of bytes.
You can read a file in ruby like this.
Cp r lib site ruby mylib examples of copying several files to target directory.
If remove destination is true this method removes each destination file before copy.
Installing ruby library mylib under the site ruby fileutils.
If suffix is given and present at the end of file name it is removed.
How to read files in ruby.