Reading, Writing, Removing Files and Directories in Ruby

       

These aren't all of them, but I think they are some of the most useful.

making a directory in another directory that doesn't yet exist...

FileUtils.mkdir_p '/path/to/your/directory/that/doesnt/exist/yet'

recursively remove a directory and the contents

FileUtils.rm_rf("/path/to/directory/you/want/to/delete")

write a file from the contents of another file...

File.open("/path/to/the/file.ext", "wb") {|f| f.write(@your_other_file.read)}

Tagged w/ #directories #files #io #reading #ruby #writingruby

Apps I've Built

PhotoLocationChanger
Easily change the location on your photos and videos
Click here for more info about the app
PhotoDateChanger
Easily change the dates and times on your photos and videos
Click here for more info about the app
VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app