|
#!/bin/bash
|
|
|
|
uploaddir='/var/www/html/files';
|
|
timeout=30
|
|
|
|
list=`ls ${uploaddir}`
|
|
|
|
for file in ${list}
|
|
do
|
|
prefix=`echo ${file} | awk -F '-' '{ print $1}'`
|
|
stamp=`date +%s`
|
|
delta=`expr ${stamp} - ${prefix}`
|
|
|
|
if [[ "$delta" -gt "$timeout" ]]
|
|
then
|
|
rm -f "${uploaddir}/${file}"
|
|
fi
|
|
done
|