



























一个删除旧文件的函数,通常用于删除较老的log文件。
module FileUtils2
ONE_DAY_SECONDS = 60*60*24
# remove the old files, return the number of files that removed.
def remove_old_files(dir_path, days_ago)
count = 0
dir_path2 = dir_path + File::ALT_SEPARATOR unless dir_path.end_with?(File::ALT_SEPARATOR)
d = Dir.new dir_path2
now
= Time.nowfile_path
= dir_path2 + filename此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。