[prog] Perl and find(1)

Chris Henderson hendersochris at gmail.com
Mon Dec 11 03:46:13 UTC 2006


I wrote this script which will go inside some directories and delete
files but the find(1) command says "-exec" missing. Is it because I'm
not parsing ls correctly?

#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;

my @directories = qw(
    /home/backup/server1
    /home/backup/server2
    /home/backup/server3
);

system "find @directories -atime +14 -name \"*.tgz\" -print -exec ls -al {} \;";


More information about the Programming mailing list