Hi all,

I posted this on this forum but under a different Subject. Here is the finished script for those who might be interested.

Thanks to all who helped me with this.

Mark

------------------------------------------------------------------------ -------------------
#!/usr/bin/perl -w


use strict;
use File::Copy;

# Name of files to copy, as many as you need
my @dbname = ("db1.txt","db2.txt","db3.txt","db4.txt");

# Pathway after the main server name - Pathways must match the files above, array number for array number
my @dbpath = ("pathway/to/files","pathway/to/files","pathway/to/files","pathway/to/ files");


# Basic root directory for where the files will be copied TO
my $dirto = "/Volumes/OEMWorkgroup\;OEMCOMPUTER/"; # Example of the root server path to a shared folder on a PC


# Basic root directory for where the files will be copied FROM
my $dirfrom = "/Users/xxxxxx/Documents/";

my ($backup, $i);

my $timetest = time;

my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime($timetest);
$year = substr(1900 + $year,2,2);
$mon++;
if ($mon  < 10) { $mon  = "0$mon";  }
if ($mday < 10) { $mday = "0$mday"; }
my $date = "$mon-$mday-$year";

for ($i=0; $i<=$#dbname; $i++) {
$backup = "$dbname[$i]-$date.bak";
copy ("$dirfrom$dbpath[$i]/$dbname[$i]", "$dirto$backup") or warn "Can't copy file $dirfrom$dbpath[$i]/$dbname[$i] to $dirto$backup - $!\n";
if (-e "$dirto$backup") {
print "$dbname[$i] backed up.\n";
} else {
print "$dbname[$i] NOT backed up!\n";
}
}


print "Backup Complete.\n";
------------------------------------------------------------------------ ------------



On May 1, 2004, at 9:11 AM, Sherm Pendley wrote:

On May 1, 2004, at 11:59 AM, Mark Wheeler wrote:

OK, I think I got it. When I get to work tomorrow I'll test it out. One last question. Is there a web site or book I can read that goes through all that you've shared with me? I'd like to learn more.

The Perl side of things is described in 'perldoc perlop', in the section "Quote and Quote-like Operators".


I haven't read it, but I've heard Good Things about O'Reilly's "Learning Unix for Mac OS X Panther":

<http://www.oreilly.com/catalog/lunixpanther/>

sherm--




Reply via email to