Skip to content

Instantly share code, notes, and snippets.

@TeTiRoss
Created January 17, 2019 08:24
Show Gist options
  • Save TeTiRoss/e9a96a3d2fb50bc766d77e46cd17de1e to your computer and use it in GitHub Desktop.
Save TeTiRoss/e9a96a3d2fb50bc766d77e46cd17de1e to your computer and use it in GitHub Desktop.
copy files from one dir to another with ruby
require 'fileutils'
dirs = Dir["/users/username/pictures/categories/*"]
dest_folder = "/users/username/pictures/pets/"
dirs.each do |dir|
pics = Dir["#{dir}/*"]
pics.each do |pic|
FileUtils.cp(pic, dest_folder)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment