stack twitter tryhackme rss linkedin cross

Wilco van Esch

Skip to main content

Search results

    Ruby Dir methods being performed on the current directory

    Dir operations are performed on the directory they're called from, regardless of what directory you feed in. So Dir.glob or Dir.foreach or Dir.entries on (base_dir + '*.something').count won't return expected results.

    You'll need to change directory, then perform the operation, e.g.

    Dir.chdir(base_dir)
    Dir.glob('*.something').count