Join Kevin Skoglund for an in-depth discussion in this video Rename, delete, copy, part of Ruby: Files, Formats, Templates.
- [Instructor] In this movie, we're going to learn how…to rename, delete, and copy files.…Rename and delete are fairly straight forward, because there…are class methods on file that let us perform these tasks.…File.rename and then you use the file's old name…and the file's new name, so it's a full path to the file…this assumes that we're in the same directory as those files…but you could have a full path to what…you wanted to rename the file.…File.delete will just delete the file.…You go to path name, and it will delete that file.…Copy on the other hand though is a little trickier,…because there's not a built in class method…on the file class for copy.…
Instead, we need to use something called FileUtils.…This is a built in part of the Ruby Standard Library,…if you have Ruby installed, you have the file utilities…installed, but you have to require them first.…They're not loaded into memory by default, so you just have…to have a line that says require and then fileutils…and Ruby will know to go and get the file utilities out of…
- File system basics
- Writing to and reading from files
- Renaming, deleting, and copying files
- Creating and editing directories
- Working with common data formats
- ERB templating
Skill Level Beginner
Ruby on Rails 5 Essential Trainingwith Kevin Skoglund10h 21m Beginner
1. The File System
2. Work with Files
3. Work with Directories
4. Common Data Formats
5. ERB Templating
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.