Sha256: dcf010cda5262878bced00bf67db329cb0c030454958ff022ae1736fdd78a23e

Contents?: true

Size: 413 Bytes

Versions: 183

Compression:

Stored size: 413 Bytes

Contents

#!/usr/bin/env ruby

require 'fileutils'
include FileUtils::Verbose

def usage
  STDERR.puts "Usage: #$0 prefix"
end

ARGV.empty? and usage
prefix = ARGV.shift
files = ARGV.sort_by do |x|
  if m = /(\d+)/.match(x)
    [ m.pre_match == prefix ? -1 : 0, m[1].to_i ]
  else
    [ -1, 0 ]
  end
end
for f in files
  mv f, f + '.tmp'
end
i = 1
for f in files
  mv f + '.tmp', sprintf("%s%03u", prefix, i)
  i += 1
end

Version data entries

183 entries across 183 versions & 1 rubygems

Version Path
utils-0.60.1 bin/number_files
utils-0.60.0 bin/number_files
utils-0.59.2 bin/number_files
utils-0.59.1 bin/number_files
utils-0.59.0 bin/number_files
utils-0.58.0 bin/number_files
utils-0.57.1 bin/number_files
utils-0.57.0 bin/number_files
utils-0.56.1 bin/number_files
utils-0.56.0 bin/number_files
utils-0.55.0 bin/number_files
utils-0.54.1 bin/number_files
utils-0.54.0 bin/number_files
utils-0.53.1 bin/number_files
utils-0.53.0 bin/number_files
utils-0.52.1 bin/number_files
utils-0.52.0 bin/number_files
utils-0.51.1 bin/number_files
utils-0.51.0 bin/number_files
utils-0.50.0 bin/number_files