Can somebody convert this short Perl Script to PHP?

From: Date: Mon, 29 Dec 2003 16:50:17 +0000
Subject: Can somebody convert this short Perl Script to PHP?
Groups: php.general 
Request: Send a blank email to php-general+get-173436@lists.php.net to get a copy of this message
Hi, I am trying to make a log rotator and found a great perl script to do it but, would really like it in PHP (one less langauge to maintain). I know the system has "things" in place to do this but, I don't have access to the system /etc/log/ folder or the system log rotation scripts. I figured a simple php command line script would be a good alternative to maintain my own logs. Here's the perl script: #!/usr/bin/perl $LOGPATH='/Users/cv_admin/mylogs'; @LOGNAMES=('housekeeper_log_deleter.log','mysqlbackups_deleter.log','webbac kups_deleter.log'); $MAXCYCLE = 4; chdir $LOGPATH; # Change to the log directory foreach $filename (@LOGNAMES) { for (my $s=$MAXCYCLE; $s >= 0; $s-- ) { $oldname = $s ? "$filename.$s" : $filename; $newname = join(".",$filename,$s+1); rename $oldname,$newname if -e $oldname; } } Don Myers

« previous php.general (#173436) next »