find /path/ -ctime 1 or find /path/ -ctime -1
As a non native english speaker is hard to me to understand exactaly what this does.
I'm trying to find files that are older than n days and delete them after using
foreach my $l (@list){
`rm $l`;
}
what is going on here then? Why is it not removing the files?
my @a = `find /home/osboxes/Desktop/teste -ctime -1`;
print @a;
foreach my $l (@a){
unlink $linha;
}
I have tried using the shell to rm the files:
rm $linha;
OUTPUT:
/home/osboxes/Desktop/teste
/home/osboxes/Desktop/teste/asdads
/home/osboxes/Desktop/teste/asdasdwqe
The find
command is not in perl
, it's in the shell. In other words, it's a system command. You can learn about it by reading the find man page.
The -ctime
test checks whether the file's status was changed before (+1) or after (-1) 1 day from today. You can read more about ctime
here.