develooper Front page | perl.beginners | Postings from March 2002

Anyone familiar with Perl for Netware

Thread Next
Louden, Chris
March 4, 2002 12:55
Anyone familiar with Perl for Netware
Message ID:
Hello, just joined the group looking for some help with Perl. I used to have
an NT box running Perl from Active State, it died in a most gruesome way.
Now I have a Novell 5.1 Server. Trying to reconfigure some of the scripts to
run in the Novell environment. 

On NT I had a script that ran on the hour and checked a specified directory
for data that was modified in the last hour and made copies of that data to
another directory, basically hourly backups. I kept a couple of weeks work
of the hourly usually. It saved me from going to the tape backups a lot
except for really old stuff. 

Obviously NT and Novell are two totally different environments, for one the
Novell being a nix uses "cp" instead of "copy". I've added copy as an alias
to cp so copy works now, but I can't seem to figure out how to type in the
paths to the directories I want to backup. 

Appreciate if anyone could help me figure out how to edit this script to be
Novell friendly. I am a complete and total newbie to Perl.

here is the old NT version of the script, which backed up the G drive to the
I:\backups directory
use File::stat;
use File::Copy;
use File::Path;
#use File::Basename;

$now = time;

	$YDAY, $ISDAYLITE)= localtime();

$DAY = sprintf("%02d-%02d-%02d", ++$MON, $MDAY, 1900+$YEAR);
$CURR_HOUR = sprintf("%02d", $HOUR);


sub traverse {
    local($dir) = shift;
    unless (opendir(DIR, $dir)) {
	warn "Can't open $dir\n";
    foreach (readdir(DIR)) {
	next if $_ eq '.' || $_ eq '..' ;
	$path = "$dir/$_";
	if (-d $path) {		# a directory
	} elsif (-f _) {	# a plain file

	# print "$path\n";	# Print full path to display

          $date_string = (stat($path)->mtime);
		if ($now - $date_string < 3600) {	# is file modified
in the last hour ?
		$dest =$dir;
		$dest =~ s/g:/i:\/Backups\/$DAY\/$CURR_HOUR\/Gdrive/g;	
		$dest1 = "$dest/$_";
		# print "Backing up $path TO Hourly Backup Drive...\n";
		mkpath ("$dest");
		copy $path, $dest1;

Chris Louden
Engineering Automation Support
Bechtel Nevada / D.O.E.
702-295-2336 -phone
702-794-1968 -pager

click on the link below to send a text message to my pager:

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About