Ezfile

Ezfile is a file util more safety than another gem FileUtils

copy_file , mainname, move_file, rename, remainame

Installation

gem install ezfile

Usage

require 'ezfile'

pwd = Dir.pwd

Ezfile.files("*") # default is "*" 
.group_by{|fname| Ezfile.mainname}
.select{|mname, fs| fs.any{|f| Ezfile.extname(f) == ".ass"}}
.each do |fname, fs|
    ass = File.combine(pwd, fname +".ass")
    mp4 = File.combine(pwd, fname +".mp4")
    outf = fname+".done.mp4"
    system %Q(ffmpeg -i #{mp4.inspect} -vf subtitles=#{ass.inspect} -c:v h264_nvenc "./out/#{outf}")
end

Use Ezfile.help to get help.

Ezfile.help

"              require FileUtils and Dir, File.\n          methods:\n           MOVE :\n          ::move_file file_path target_dir, mkdir: false\n              move file to target directory\n              ! if directory is non-exist,\n              throw an error.\n          ::move_file  file_path, target_dir\n              if non-exist, mkdir\n           QUERY :   its syntax like Explorer Search\n          ::file_list  target_dir = \"*\"     alias ::files\n          ::dir_list  target_dir = \"*\"      alias ::dirs\n              show list of files/directories, of target_dir.\n              ! using Dir.glob(target_dir)\n          ::glob query\n              the same as Dir.glob(query)\n\n           RENAME :\n          ::rebasename_file src_file_path, new_basename\n              it change a file's basename, and ensure never move it or change its parent node.\n\n           DELETE :\n            ::ensure_permanently_delete_file target_file     alias ::files\n            ::ensure_permanently_delete_directory_and_its_descendant target_dir     alias ::files\n"

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/saisui/ezfilerb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.