12.4. Directory manipulation with the Dir class
Like File, the Dir class provides useful class and instance methods. To create a Dir instance, you pass a directory path to new:
The most common and useful Dir-related technique is iteration through the entries (files, links, other directories) in a directory.
12.4.1. Reading a directory’s entries
You can get hold of the entries in one of two ways: using the entries method or using the glob technique. The main difference is that globbing the directory doesn’t return hidden entries, which on many operating systems (including all UNIX-like systems) means entries whose names start with a period. Globbing ...
Get The Well-Grounded Rubyist, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.