我曾经自己写过一个脚本:
复制内容到剪贴板
代码:
#!/bin/bash
if [ $# == 1 ]; then
echo -ne "Deleting FILES including [$1] in the CURRENT directory ...\n"
for i in $(tree -a -f -i | grep "$1")
do
rm -f $i
done
elif [ $# == 2 ]; then
echo -ne "Deleting FILES including [$1] in [$2] directory ...\n"
for i in $(tree -a -f -i $2 |grep "$1")
do
rm -f $i
done
else
echo -ne "Arguments Error.\n"
echo -ne "Usage:\n"
echo -ne "\t$0 STRING\n"
echo -ne "\t$0 STRING DIRECTORY\n"
fi用法:
复制内容到剪贴板
代码:
rm_sth.sh string directory删除 directory 目录下面文件名包含 string 字串的文件。
如果文件名中有空格就需要再做进一步判断。
[
本帖最后由 zhy2111314 于 2008-1-25 23:38 编辑 ]