Skip to content

Instantly share code, notes, and snippets.

@arosh
Created June 24, 2011 13:44
Show Gist options
  • Save arosh/1044786 to your computer and use it in GitHub Desktop.
Save arosh/1044786 to your computer and use it in GitHub Desktop.
NicoCache_nl cached files deleter
#!/usr/bin/ruby -Ku
def fileDel(f_name)
puts f_name
File::delete(f_name)
end
Dir::glob("*.{swf,mp4,flv}").each do |file|
diff = (Time.now - File::mtime(file)).div(24 * 60 * 60)
if diff > 90
fileDel(file)
elsif diff > 14 and file =~ /(^nltmp_|low)/
fileDel(file)
elsif diff > 1 and FileTest.size(file) < 2 * 1024 * 1024
fileDel(file)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment