Debbie McNerney wrote:
> 
> Please accept my apologies for being so dumb. I am a beginner and really
> have done basic perl scripting by using the "copy and paste and modify"
> method of script writing.
> 
> I have a server running Solaris 8. From what I can determine, perl is
> version 4 on it (perl -v). Server came preinstalled with proprietary
> software for managing ads in our production dept.
> 
> I have a newly created directory that contains links to what will soon be
> thousands of files. The number of links in this directory will grow daily.
> 
> I am trying to write a simple perl script that can be automatically run by a
> cron  that will delete these links after 3 days. I "borrowed" a script that
> runs successfully on a Linux server here and does exactly the same thing.
> 
> Could someone look at this script and tell me where to begin debugging it.
> when i run it in a command window, i get a server error "dir_prefix is not
> defined".
> 
> ----------------------------------
> 
> #!/usr/bin/perl
> 
> $dir_prefix="/directoryoffroot/debbietest";

Is "directoryoffroot" actually, really, part of the path?  Like, you
have a directory in your root directory named /directoryoffroot ?

Bompa



> 
> opendir(fotodir,$dir_prefix);
> @directory=grep(!/^\./, readdir(fotodir));
> 
> open(rep_fil,">/fotorep.txt");
> 
> print rep_fil "  The following files deleted because they were
> 1 days old...\n\n";
> 
> foreach $dir_entry (@directory)
> {
>    $file_name=$dir_prefix."/".$dir_entry;
>    $file_days=(-M $file_name);
>    if ($file_days>1)
>    {
>       system("rm -f -r \"$file_name\"");
>       print rep_fil "$file_name\n";
>    }
> }
> print rep_fil "\n            ***END OF REPORT***";
> close(rep_fil);
> 
> $sj="-s \"Kill the links\"";
> system("mail $sj root\@whatever.com < /fotorep.txt");
> --
> Debbie McNerney, Systems Dept.
> The News-Journal Corp.®
> 901 6th Street
> Daytona Beach, Florida 32117
> 386-252-1511 ext. 2314
> [EMAIL PROTECTED]
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to