Skip to content

Instantly share code, notes, and snippets.

@foxweb
Created May 3, 2024 07:56
Show Gist options
  • Save foxweb/17abff39ed624bb605d451a755f220fa to your computer and use it in GitHub Desktop.
Save foxweb/17abff39ed624bb605d451a755f220fa to your computer and use it in GitHub Desktop.
Sorting and ordering photos/videos from camera by directories named by date
extensions = ['*.MOV', '*.MP4', '*.JPG', '*.DNG', '*.SRT']
dir_list = Dir.glob(extensions)
dir_list.map{|f| date = File.mtime(f).strftime('%F'); Dir.mkdir(date) unless Dir.exist?(date); FileUtils.mv(f, date)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment