-
-
Save rtipton/b0fc7c05aee7c6cc41fb58f16fc35f11 to your computer and use it in GitHub Desktop.
Reads contents of directory. Copies DSC1234 Elm Street - Bedroom 1.jpg to Elm Street - Bedroom 1.jpg Written and used for Hallway 2 Marketing real estate jobs
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
# Reads through a directory copying files like "DSC_1234 Elm Street - Bedroom 1.jpg" to "Elm Street - Bedrooom 1.jpg" | |
# Written and used for Hallway 2 Marketing real estate jobs | |
require 'FileUtils' | |
file_path = "C:\\_Transfer\\" | |
def cls | |
system('cls') | |
end | |
cls | |
# Building array of files in the directory | |
def fileList | |
Dir.entries('C:\_Transfer') | |
end | |
# Loop through the array setting file names and copying to new files | |
fileList.each do |fileNm| | |
if fileNm[0...3] == 'DSC' | |
puts "Copying " + fileNm + " => " + fileNm[9...60] | |
file1 = file_path + fileNm | |
file2 = file_path + fileNm[9...60] | |
FileUtils.cp(file1, file2) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment