Ruby nooby

I am clueless. Mostly.

I program phone switches for a living.

I have lots of data images for multiple platforms.

The information of interest will be the file extension and perhaps the
date/time stamp.

I want to write a script that will go through my BACKUPS folder and do
the following:

  1. Create folders for each platform in some arbitrary location, if the
    folders already exist then gracefully move on.

  2. Copy data image files by extension into the appropriate newly created
    folders.

  3. Sort the files that now exist in the newly created folders by date,
    preferably by month.

Much thanks in advance.

At present, I go through the BACKUP folder once a month and manually
select the files I need and sort them out. Once done I copy them to my
manager for safe keeping on the office server.

Anthony

anthony wrote:

preferably by month.

Much thanks in advance.

Was there a question in there somewhere?

anthony wrote:

  1. Create folders for each platform in some arbitrary location, if the
    folders already exist then gracefully move on.

File.exist?()
Dir.mkdir()

  1. Copy data image files by extension into the appropriate newly created
    folders.

require ‘fileutils’

FileUtils::cp(src, dest, {:verbose => true, :preserve => true})

  1. Sort the files that now exist in the newly created folders by date,
    preferably by month.

Dir.glob()
Enumerable#sort_by
File.new()
File#mtime