I want to write a simple program that recurses through a given directory, skips if one of a set of excluded directories / strings is found in the complete path&filename OR a file does not exist / is empty and lists the rest, along with file size and creation time.
My attempt looks like this, but it doesnt work:
dir_ignore=[".AppleDouble",".AppleDB",".AppleDesktop",".DS_Store"]
require 'find'
Find.find('/Volumes/Downloads') { |dir_entry|
next if dir_ignore.any? {|skip| dir_entry.include? skip} || !File.exist?(dir_entry)
dir = ["filename" => dir_entry],["filesize" => File.size(dir_entry)],["creationdate" => File.ctime(dir_entry)]
puts dir
}
The program still lists all the files in an ".AppleDouble" directory and finally crashes on a non-existant file. So obviously my boolean expression does not work...
Why?