Example:
in /usr/
i have
/usr/101
/usr/102 ...... /usr/200
This is the command i type and it works, i got the directory listed where the number is <150
Expand|Select|Wrap|Line Numbers
- ls -l /usr/ | grep ^d | awk '{ if ( $9 < 150) print $9 }'
Expand|Select|Wrap|Line Numbers
- #!/bin/bash -xv
- COPYKEEP="10"
- LATEST="200"
- KEEPFROM=`expr $LATEST - $COPYKEEP`
- if [ $KEEPFROM -gt 0 ]
- then
- # Find which to delete.
- ls -l /usr/ | grep ^d | awk '{ if ( $9 < $KEEPFROM ) print $9 }'
- fi