我創建了腳本來比較文件夾中的文件(名稱爲.jpg,沒有它但具有相同的名稱)。腳本在ONE目錄中搜索文件的問題,而不是在SubDirectories中!可以修復它?使用相同名稱比較文件
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
你想檢測同一目錄下同名文件,或者是你tyring找到他們在任何目錄?防爆。 「./a/b/c/foo.jpg」和「./d/e/foo」 –
我正試圖在任何目錄中找到同名文件 – user3027156