1
似乎无法破解这一个。Bash排除点短划线前缀
我有一个bash脚本来搜索一个文件夹并排除某些文件类型。
list=`find . -type f ! \(-name "*data.php" -o -name "*.log" -o -iname "._*" -o -path "*patch" \)`
我想排除以dot-dash ._开头的文件,但以上只是拒绝工作。
这里的一些剧本,但我仍然得到与开始复制文件与._
O/S是CentOS的5.3
list=`find . -type f ! \(-name "*data.php" -o -name "*.log" -o -iname "._*" -o -path "*patch" \)`
for a in $list; do
if [ ! -f "$OLDFOL$a" ]; then
cp --preserve=all --parents $a $UPGFOL
continue
fi
diff $a "$OLDFOL$a" > /dev/null
if [[ "$?" == "1" ]]; then
# exists & different so copy
cp --preserve=all --parents $a $UPGFOL
fi
done
适合我(在GNU find版本4.1.20) – dogbane
你的意思是点下划线? –
甚至可以在WinXP/Cygwin上使用findutils 4.5.9。那么,它不起作用是什么? – carlpett