【发布时间】:2013-11-24 12:01:59
【问题描述】:
我创建了脚本来比较文件夹中的文件(名称为 .jpg,但没有它但名称相同)。脚本在一个目录中搜索文件的问题,而不是在子目录中!我该如何解决?
for f in *
do
for n in *.jpg
do
tempfile="${n##*/}"
echo "Processing"
echo "${tempfile%.*}"
echo "$f"
if [[ "${tempfile%.*}" = $f ]]
then
echo "This files have the same name!"
//do something here
else
echo "No files"
fi
done
done
【问题讨论】:
-
您是想检测同一目录中的同名文件,还是想在任何目录中找到它们?前任。 “./a/b/c/foo.jpg”和“./d/e/foo”
-
我正在尝试在任何目录中查找同名文件