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.21.2 bin/number_files
utils-0.21.1 bin/number_files
utils-0.21.0 bin/number_files
utils-0.20.0 bin/number_files
utils-0.19.0 bin/number_files
utils-0.18.1 bin/number_files
utils-0.18.0 bin/number_files
utils-0.17.0 bin/number_files
utils-0.16.0 bin/number_files
utils-0.15.1 bin/number_files
utils-0.15.0 bin/number_files
utils-0.14.0 bin/number_files
utils-0.13.0 bin/number_files
utils-0.12.0 bin/number_files
utils-0.11.0 bin/number_files
utils-0.10.1 bin/number_files
utils-0.10.0 bin/number_files
utils-0.9.0 bin/number_files
utils-0.2.4 bin/number_files
utils-0.2.3 bin/number_files