Created
June 24, 2011 13:44
-
-
Save arosh/1044786 to your computer and use it in GitHub Desktop.
NicoCache_nl cached files deleter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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