stack twitter tryhackme rss linkedin cross

Wilco van Esch

Skip to main content

Search results

    Find files through Ruby excluding those with a specific extension

    If Dir.pwd is the path you want to search including its subdirectories:

    ignore_ext = [".xlsx"]
    
    Find.find('.') do |file|
      next if ignored_ext.include?(File.extname(file))
      || File.directory?(file)
      puts file
    end