Untitled
unknown
plain_text
2 years ago
848 B
7
Indexable
#!/bin/bash
# Thư mục hiện tại
current_directory=$(pwd)
# Thư mục đích (/tmp/)
destination_directory="/tmp/"
# Duyệt qua tất cả các file .zip trong thư mục hiện tại
for zip_file in "$current_directory"/*.zip; do
if [ -f "$zip_file" ]; then
# Lấy tên file (không bao gồm đường dẫn)
file_name=$(basename "$zip_file")
# Giải nén file .zip
unzip -q "$zip_file" -d "$destination_directory"
# Kiểm tra xem quá trình giải nén có thành công không
if [ $? -eq 0 ]; then
echo "Giải nén '$file_name' thành công và đã chuyển vào '$destination_directory'"
# Xóa file .zip sau khi giải nén
rm -f "$zip_file"
else
echo "Giải nén '$file_name' thất bại."
fi
fi
done
Editor is loading...