Skip to content

Instantly share code, notes, and snippets.

@foru17
Created September 27, 2017 04:01
Show Gist options
  • Save foru17/4c7a241c95fe6f01e4f2575f36973559 to your computer and use it in GitHub Desktop.
Save foru17/4c7a241c95fe6f01e4f2575f36973559 to your computer and use it in GitHub Desktop.
预处理清理上传的文件夹和文件。
#!/bin/bash
# Author luolei
# Updated 2017-09-25
LOGFILE=/data/logs/ars/ars_preclean.log
ZERO=`date +%s%N`
echo '====================' >> $LOGFILE
echo 'Start the preclean process ...' >> $LOGFILE
echo 'Param: ' $1 >> $LOGFILE
for line in `cat $1`
do
echo 'Item: ' $line >> $LOGFILE
if [ -d $line ]; then
rm -rf $line >> $LOGFILE
elif [ -f $line ]; then
echo 'File: ' $line >> $LOGFILE
rm $line >> $LOGFILE
fi
done
echo 'Done.' >> $LOGFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment