Class: Lhj::Command::Rename

Inherits:
Lhj::Command show all
Defined in:
lib/lhj/command/rename_image.rb

Instance Method Summary collapse

Instance Method Details

#renameObject



11
12
13
14
15
16
17
# File 'lib/lhj/command/rename_image.rb', line 11

def rename
  folder_path = "~/Downloads/ss"
  Dir.glob("#{folder_path}/**/*.{png}").sort.each do |f|
    filename = File.basename(f, File.extname(f))
    File.rename(f, "#{folder_path}/aomi_soldout_" + filename.capitalize + File.extname(f))
  end
end

#runObject



7
8
9
# File 'lib/lhj/command/rename_image.rb', line 7

def run
  rename
end