Sha256: b5724c8f2e07b57fe6a1bc99c0068d1d61036067020899c9b20430724a99e19f
Contents?: true
Size: 759 Bytes
Versions: 2
Compression:
Stored size: 759 Bytes
Contents
#! /usr/bin/env ruby # coding: utf-8 require "pp" require "filerenamer.rb" require "optparse" ## option analysis OPTIONS = {} op = OptionParser.new #op.banner = [ # "Usage: #{File.basename("#{__FILE__}")}", #].join("\n") op.on("-p" , "--preserve" , "Preserve old name"){OPTIONS[:preserve] = true} op.parse!(ARGV) op = FileRenamer::OptionParser.new op.parse!(ARGV) fr = FileRenamer::Commander.new(op.options, ARGV) fr.execute do |filename| extname = File.extname filename old_base = filename.sub(/#{extname}$/, "") dirname = File.dirname filename date = File.mtime(filename) new_basename = dirname + date.strftime("/%Y%m%d-%H%M%S") new_basename += "-#{old_base}" if OPTIONS[:preserve] newname = new_basename + extname newname end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
filerenamer-0.0.9 | bin/rentime |
filerenamer-0.0.8 | bin/rentime |