Initial situation: Each week a nested folder-/file-structure has to be created. Content is added to the files. Afterward the structure is copied to a shared-folder for long-time documentation.
Example:
The idea is now to write a script, which automates the folder-structure creation.
Here's what I have implemented:
require "date"
require "fileutils"
projects_path = "./reports/#{Time.now.strftime("%Y_%m_%d_%H_%M")}"
dir_paths = []
dir_paths << projects_path
["alpha", "beta", "gamma"].each do |name|
  dir_paths << "#{projects_path}/team_#{name}"
end
if Dir.exist? projects_path
  puts "#{projects_path} does already exist.\nExiting."
  exit true
else
  FileUtils.mkdir_p dir_paths
  dir_paths[1...(dir_paths.length)].each do |path|
    FileUtils.touch [
      "#{path}/logs.txt",
      "#{path}/notes.txt" ]
  end
  puts "Created directory '#{projects_path}' successfully."
end
- Could my implementation become improved?
- Would you have chosen a complete different approach, for implementing the solution? How would you have done it?

