Some memo when doing some file operations with ruby.
# Get files recursively
Dir.glob("**/*.txt") do |f|
# Do something..
end
# Directory check
Dir.exist?(directory_name)
# File check
File.exist?(file_name)
# Get file name from path
File.basename(path)
# Get directory name from path
File.dirname(path)
# Create directory recursively
FileUtils.mkdir_p(dir_path)
# Copy
FileUtils.cp(source_file, destination_dir)
# Any command
`mv #{source} #{destination}`