G
grocery_stocker
The following code is taken from
http://groups.google.com/group/perl.beginners/browse_thread/thread/c1b0afccf5fffccf/?hl=en#
# open the current directory
opendir my $dh, '.' or die "Cannot open '.' $!";
# get files older than three days
my @files = grep -M > 3, readdir $dh;
closedir $dh;
for my $file ( @files ) {
rename $file, "history/$file" or die "Cannot move '$file' $!";
}
What does grep -M do? Is this a perl option for grep? I don't see this
option when I look up grep on the unix man pages. I tried searching
google and found nothing.
Chad
http://groups.google.com/group/perl.beginners/browse_thread/thread/c1b0afccf5fffccf/?hl=en#
# open the current directory
opendir my $dh, '.' or die "Cannot open '.' $!";
# get files older than three days
my @files = grep -M > 3, readdir $dh;
closedir $dh;
for my $file ( @files ) {
rename $file, "history/$file" or die "Cannot move '$file' $!";
}
What does grep -M do? Is this a perl option for grep? I don't see this
option when I look up grep on the unix man pages. I tried searching
google and found nothing.
Chad