FIX: crashing job
This commit is contained in:
parent
95f9943d28
commit
1ccfb4fa20
|
@ -11,10 +11,12 @@ class ExportCsv
|
||||||
|
|
||||||
def self.remove_old_exports
|
def self.remove_old_exports
|
||||||
if Dir.exists?(ExportCsv.base_directory)
|
if Dir.exists?(ExportCsv.base_directory)
|
||||||
dir = Dir.new(ExportCsv.base_directory)
|
Dir.foreach(ExportCsv.base_directory) do |file|
|
||||||
dir.each do |file|
|
path = File.join(ExportCsv.base_directory, file)
|
||||||
if (File.mtime(File.join(ExportCsv.base_directory, file)) < 2.days.ago)
|
next if File.directory? path
|
||||||
File.delete(File.join(ExportCsv.base_directory, file))
|
|
||||||
|
if (File.mtime(path) < 2.days.ago)
|
||||||
|
File.delete(path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue