wileykt has asked for the wisdom of the Perl Monks concerning the following question:

I'm using cron to run a perl script that cleans up files older than a certain date. This works fine. My problem is that some of the files were created by oracle in 664 mode. This means that I as a regular unix user don't have the permission to delete these files unless I confirm the deletion manually. Meaning, I can go delete the files, but I'm prompted for confirmation each time. My question is, does anyone know a workaround in perl so I can cron this file deletion script, and not have it fail because of the file permissions?

Thanks - Keith

Replies are listed 'Best First'.
Re: Cron, PERL and file permissions
by merlyn (Sage) on Jan 05, 2002 at 22:01 UTC
    There's no "confirmation" required for unlink - you either have permission or you don't. Are you by some chance using the rm command instead of unlink?

    -- Randal L. Schwartz, Perl hacker

      ..and even if he is (un-wisely) using rm instead of unlink, the rm's "-f" option would bypass that confirmation.
Re: Cron, PERL and file permissions
by jonjacobmoon (Pilgrim) on Jan 05, 2002 at 22:37 UTC
    Why not simply run the script off of Oracle's crontab? I would think that that would do the trick.
Re: Cron, PERL and file permissions
by cyocum (Curate) on Jan 06, 2002 at 14:38 UTC
    I think that you could also use the Expect module that allows programmatic access to prompts. Check here: http://search.cpan.org/search?dist=Expect.