I'm currently working on a project in ruby, and I hit a wall on how I should proceed. In the project I'm using Dir.glob to search a directory and all of its subdirectories for certain file types and placing them into an arrays. The type of files I'm working with all have the same file name and are differentiated by their extensions. For example,
txt_files = Dir.glob("**/*.txt")
doc_files = Dir.glob("**/*.doc")
rtf_files = Dir.glob("**/*.rtf")
Would return something similar to,
FILECON.txt ASSORTED.txt FIRST.txt
FILECON.doc ASSORTED.doc FIRST.doc
FILECON.rtf ASSORTED.rtf FIRST.rtf
So, the question I have is how I could break down these arrays efficiently (dealing with thousands of files) and placing all files with the same filename into an array. The new array would look like,
FILECON.txt FILECON.doc FILECON.rtf
ASSORTED.txt ASSORTED.doc ASSORTED.rtf
etc. etc.
I'm not even sure if glob would be the correct way to do this (all the files with the same file name are in the same folders). Any help would be greatly appreciated!