In article <[EMAIL PROTECTED]>, Holger Rauch <[EMAIL PROTECTED]> wrote: >You're right ;-) What I'm doing is > >FILES=`$LS -lt1 $BACKUP_DIR/arc/*.arc | $TAIL -$NUM_OF_FILES` >for i in $FILES; do > $RM -f $i >done > >($LS contains the path to "ls" and $TAIL the path to "tail") > >I want to remove the oldest $NUM_OF_FILES files and it seems to me that >piping into tail fails when ls returns too many files.
No, you probably have lots of filed in $BACKUP_DIR/arc, so the expression $BACKUP_DIR/arc/*.arc expands in more arguments than is possible on the command line of ls. How about FILES=`$LS -t1 $BACKUP_DIR/arc | grep '\.arc$' | $TAIL -$NUM_OF_FILES` This way, you let ls list all files, and filter the arc files out with grep (note I left out '-l' which seems unnessecary) If _that_ list gets too long you can always do $LS -t1 $BACKUP_DIR/arc | grep '\.arc$' | $TAIL -$NUM_OF_FILES | while read i do $RM -f $i done Mike. -- Computers are useless, they only give answers. --Pablo Picasso -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]