Mercurial > dotfiles.old
view maid/general.rb @ 44:4253a2206527
Add maid rule to clean mail downloads
author | zegervdv <zegervdv@me.com> |
---|---|
date | Thu, 24 Apr 2014 18:58:35 +0200 |
parents | a761f06dbaa8 |
children | 625fc94c8e62 |
line wrap: on
line source
Maid.rules do rule 'Remove old TV-show downloads' do dir('~/Downloads/**/*.mkv').each do |mkv| trash(mkv) if 2.weeks.since?(accessed_at(mkv)) end end rule 'Remove old converted TV-shows' do trash(dir('~/Downloads/**/*.mp4')) trash(dir('~/Downloads/**/*.m4v')) end rule 'Remove old apps' do trash(dir('~/Downloads/*.dmg')) trash(dir('~/Downloads/*.pkg')) trash(dir('~/Downloads/*.zip')) trash(dir('~/Downloads/*.iso')) trash(dir('~/Downloads/*.tar')) trash(dir('~/Downloads/*.tar.*')) end rule 'Remove empty folders' do trash(dir('~/Downloads/**/*').select { |path| File.directory?(path) && File.stat(path).size < 1.megabyte }) end rule 'Remove old files' do dir('~/Downloads/**/*').each do |file| trash(file) if 4.weeks.since?(accessed_at(file)) end end rule 'Clean up Mail Downloads' do trash(dir('~/Library/Containers/com.apple.mail/Data/Library/Mail\ Downloads/*')) end end