#!/usr/bin/perl -w
# A very simple script to create a directory in the form of YYYYMMDD for saving MiniME data.
# Does so for both today and tomorrow.
#
# Written on 29 Jan 2008 by Jonathan J. Makela (jmakela@uiuc.edu)

use File::Path;
use Date::Manip;

# Initialize the timezone
Date_Init("TZ=PET");

# The location that the data gets stored (must end in \\)
my $local_stub = 'D:\\MeriHillData2009\\';

# Grab today's date
my $date = ParseDate("today");
print $date, "\n";
my $year = UnixDate($date, "%Y");
my $month = UnixDate($date, "%m");
my $day = UnixDate($date, "%d");

my $local_dir = sprintf("%s%.4d%.2d%.2d",$local_stub, $year, $month, $day);

print $local_dir, "\n";

mkpath($local_dir);

# Grab tomorow's date
$date = ParseDate("tomorrow");
print $date, "\n";
$year = UnixDate($date, "%Y");
$month = UnixDate($date, "%m");
$day = UnixDate($date, "%d");

$local_dir = sprintf("%s%.4d%.2d%.2d",$local_stub, $year, $month, $day);

print $local_dir, "\n";

mkpath($local_dir);