M
Mmcolli00 Mom
If you have a directory full of files, how can you get the newest file
and oldest file from that directory?
require 'fileutils'
require 'find'
require 'ftools'
require 'enumerator'
Dir.entries("C:/New").each do |filename|
NewestFile = filename.max
OldestFile = filename.min
puts "newest"
puts NewestFile
puts "oldest"
puts OldestFile
end
and oldest file from that directory?
require 'fileutils'
require 'find'
require 'ftools'
require 'enumerator'
Dir.entries("C:/New").each do |filename|
NewestFile = filename.max
OldestFile = filename.min
puts "newest"
puts NewestFile
puts "oldest"
puts OldestFile
end