Gossamer Forum
Quote Reply
Delete old files
Hi everybody

I am looking for a script that can delete my old linkfiles in Linkssql
i don't kwow if this is possible with a cgi script

in the moment i use the shell command find
find (Path1 of my server) -mtime +10 -exec rm -f {} \;
find (Path2 of my server) -mtime +10 -exec rm -f {} \;
find (Path3 of my server) -mtime +10 -exec rm -f {} \;

I there a possibilty to use the find command in a cgi script?

The other problem is that you can not exclude a folder like cgi-bin or image with the find commandMad
if i use the command it delete all my files older than 10 daysPirate

i want to use the script or command in a crontab

please help me

MarinaSly
Quote Reply
Re: [mkoenig] Delete old files In reply to
Try making a script, and putting something like this in it;

Code:
#!/usr/bin/perl

use strict;

my $command1 = q|find /path/to/server -mtime +10 -exec rm -f {} \;|;
my $command2 = q|find /path/to/server -mtime +10 -exec rm -f {} \;|;
my $command3 = q|find /path/to/server -mtime +10 -exec rm -f {} \;|;

system($command1);
system($command2);
system($command3);

print "\n\nDONE";

Then, just run it via SSH, by typing;

perl /full/path/to/script/admin/script_name.cgi

Hope that helps.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Delete old files In reply to
Sly
Great

Thank you very much andy

Marina Sly