#这是一个只删除当前所在目录下的所有文件夹的脚本,其他类型的文件不删除。有时候我们解压过多的压缩包,手工删掉目录很费力气,这个脚本可以帮助你。
#!/bin/bash
#This is free software,you can use it erverywhere.
#author:Yan Xiaofeng
#Email: xiaofeng_yan2004@126.com
#function: remove all directory in current directory
red='/E[31;40m'
green='/E[32;40m'
DIRECTORY_LIST=`ls`
j=0
CURRENT=`pwd`
echo -e "$CURRENT"
cd $CURRENT
echo -e "$green /bDo you want to remove all directory in current directory!"
read INPUT
if [ "$INPUT" == "y" ]; then
for i in $DIRECTORY_LIST
do
if [ -d "$i" ]; then
/bin/rm -rf $i
echo -e "$green /bRemoved file /"$i/""
let "j += 1"
tput sgr0
fi
done
if [ $j == 0 ];then
echo -e "$red /bMy sir,there is no directory here!"
tput sgr0
fi
else
echo -e "$green /bexit $CURRENT"
fi