Sha256: 7475ebbaec97e3905d21f4cb020e13f7e5e908ef3eea54ce4e1e899485cc0695

Contents?: true

Size: 484 Bytes

Versions: 1

Compression:

Stored size: 484 Bytes

Contents

require "fileutils"

module Tlapse
  class Util
    def self.normalize!(dry_run: false)
      Dir["*.jpg"].each do |filename|
        normalized = normalize_filename(filename)
        if filename != normalized
          puts "Rename #{filename} to #{normalized}"
          FileUtils.mv filename, normalize_filename unless dry_run
        end
      end
    end

    def self.normalize_filename(file)
      File.ctime(file).strftime(Tlapse::Capture::CAPTURE_FILENAME)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tlapse-0.6.0 lib/tlapse/util.rb