我有以下目录:
- Folder_A
- Folder_A1
- Folder_B
- Folder_B1
我想压缩子文件夹,所以最后我会有这样的东西:
- Folder_A1.zip
- Folder_B1.zip
您需要像这样遍历文件夹:
for folder in Folder_*/Folder*; do
cd "${folder%/*}"
zip -r ../"${folder#*/}.zip" "${folder#*/}"
cd ..
done