#!/bin/sh

utctime() {
	RESULTTIME=`ls -l --time-style=+%s $1 2> /dev/null | awk '{print $6}'`
	if [ -z "$RESULTTIME" ]; then
		RESULTTIME=`ls -l --full-time $1 2> /dev/null | awk '{print $6,$7,$8,$9,$10}'`
		RESULTTIME=`date -d "$RESULTTIME" +%s`
	fi
}

if [ ! -f $1.del ]; then
	exit 0
fi

while read FILE FILETIME; do
	if [ -e $FILE ]; then
		utctime $FILE
		if [ $FILETIME -eq $RESULTTIME ]; then
			rm -f $FILE
		fi
		if [ -z "$FILETIME" ]; then
			rm -f $FILE
		fi
	fi
done < $1.del

rm -f $1.del
