M
Mmcolli00 Mom
Hi, I have a directory full of files and want to get the newest version
of each out of the directory. The files look like below. Please tell me
if you know a way to pull out the latest version of each. Thanks
34_web1_no2_09202008.txt
34_web1_no2_09212008.txt <--want to pull out this latest version
34_web2_no3_10122008.txt
34_web2_no3_10132008.txt <--want to pull out this latest version
******snippet*******************************************
newsortfile = Dir["C:/Status2/*.html"].map{|@f|
[@f,File.mtime(@f)]}.sort_by{|@i|@i[1]}
@NewestFile = @i[1]
Dir.entries("C:/Status2/").each do |filename|
if File.mtime("C:/Status2/"+filename) == @NewestFile then
puts filename
end
end
of each out of the directory. The files look like below. Please tell me
if you know a way to pull out the latest version of each. Thanks
34_web1_no2_09202008.txt
34_web1_no2_09212008.txt <--want to pull out this latest version
34_web2_no3_10122008.txt
34_web2_no3_10132008.txt <--want to pull out this latest version
******snippet*******************************************
newsortfile = Dir["C:/Status2/*.html"].map{|@f|
[@f,File.mtime(@f)]}.sort_by{|@i|@i[1]}
@NewestFile = @i[1]
Dir.entries("C:/Status2/").each do |filename|
if File.mtime("C:/Status2/"+filename) == @NewestFile then
puts filename
end
end