Created
January 17, 2019 08:24
-
-
Save TeTiRoss/e9a96a3d2fb50bc766d77e46cd17de1e to your computer and use it in GitHub Desktop.
copy files from one dir to another with ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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