Skip to content
bbminfo – Learn from Scratch
Subjects Code examples Library reference
Computer Programming Python Java C++ C Go PHP Kotlin Ruby R Scala Groovy

Tutorial menu

Subjects

Computer Programming MathsPlanned ChemistryPlanned

Lesson contents

Programming resources

All languages Code examples Library reference

Programming languages

Python Java C++ C Go PHP Kotlin Ruby R Scala Groovy
Tutorials/Computer Programming/Ruby/Library/Files and paths

Ruby files and paths

Build a receipt path, save a note, or read a shopping list.

File.readFile.sizeFileUtils.cp

Browse by topic

  • Names and locations3
  • Read and write3
  • Manage files and folders7
  • Inspect files and storage3

Names and locations

  • File.basename and dirnamePrint a receipt name and its folder
  • File.join and File.basenameBuild a receipt path without hard-coded separators
  • Pathname.relative_path_fromLink a course handout to a diagram
Advertisements

Read and write

  • File.binread and binwriteRecover the brightest setting from a preset
  • File.readRead a saved shopping note
  • File.writeSave an item to a grocery note

Manage files and folders

  • Dir.childrenCount only the invoices in a folder
  • Dir.globFind a receipt below the month folder
  • File.deleteClear a disposable print preview
  • File.open with EXCLStop two desks claiming the same ticket
  • File.renamePublish a signed attendance sheet
  • FileUtils.cpKeep a separate copy of a receipt
  • FileUtils.mkdir_pPrepare nested hand-in folders

Inspect files and storage

  • File.file? and directory?Tell an uploaded file apart from its folder
  • File.sizeCheck a receipt attachment size
  • File.utimeRestore a newsletter publication date

All Ruby library sections

Ruby tutorials

Environment setup› Library reference› Data structures› Code examples›
Advertisements
bbminfo – Learn from Scratch
© 2026 bbminfoArtwork creditsPrivacy policy