Простая логика, чтобы сделать то же самое без разбора ls
-
stat -c "%Y %n" import*.log | # list last modification and filename
sort -rn | # sort reverse numeric on mod time
while read es fn; # read the timestamp and the filename
do if (( ++latest <= 3 )); # count each file found, for 1st 3
then continue; # do nothing, skipping them
else rm -f "$fn"; # -r for recurse only needed on dir's
fi;
done