Skip to content

Instantly share code, notes, and snippets.

View NickMoignard's full-sized avatar

Nick NickMoignard

  • Moignard Digital Solutions
  • Melbourne, Australia
View GitHub Profile

Moved

Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.

Why it was moved

Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!

@coorasse
coorasse / old_files_killer.rb
Last active October 16, 2023 14:25 — forked from pelgrim/old_file_killer.rb
A Ruby on Rails script to delete files older than X days in a given directory.
# A Ruby On Rails script to delete files older than X days in a given directory.
# Quickly written by @coorasse
class FilesCleaner
def self.call(days = 1)
Dir.glob(Rails.root.join('path', 'to', 'folder', '*')).each do |filename|
File.delete(filename) if File.mtime(filename) < days.days.ago
end
end
end