class FileOP
Public Instance Methods
is_exist_and_mk_dir(dir_path: String)
click to toggle source
# File lib/memo_for_bin/FileOP.rb, line 28 def is_exist_and_mk_dir(dir_path: String) if !Dir.exists?("#{dir_path}") FileUtils.mkdir_p("#{dir_path}") puts "created new Dir named #{dir_path}" else puts "#{dir_path} is already existed" end end
is_exist_and_mk_file(file_path: String)
click to toggle source
# File lib/memo_for_bin/FileOP.rb, line 19 def is_exist_and_mk_file(file_path: String) if !File.exists?("#{file_path}") FileUtils.touch("#{file_path}") puts "created new File named #{file_path}" else puts "#{file_path} is already existed" end end
is_exist_and_rm_file(file_path: String)
click to toggle source
# File lib/memo_for_bin/FileOP.rb, line 37 def is_exist_and_rm_file(file_path: String) if File.exists?("#{file_path}") FileUtils.rm("#{file_path}") puts "remove File named #{file_path}" else puts "#{file_path} is not existed" end end
is_exist_dir_and_mk_files(checked_dir:String, files: [String])
click to toggle source
# File lib/memo_for_bin/FileOP.rb, line 5 def is_exist_dir_and_mk_files(checked_dir:String, files: [String]) if !Dir.exists?("#{checked_dir}") p files files.each do |file| p file FileUtils.mkdir_p("#{checked_dir}") FileUtils.touch("#{checked_dir}/#{file}") end puts "created new Dir named #{checked_dir}" else puts "#{checked_dir} is already existed" end end