#!/bin/bash files="$HOME/.xsession-errors " for file in $files do size=$(du -ms $file | cut -f 1) echo date if [ "$size" -gt 10 ]; then # If file is bigger than 10M du -hs $file echo > $file fi done