File size: 1,645 Bytes
d9c5be3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
#!/bin/bash
REMOVE_ZIPS=false
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--rm-zips|-rm)
REMOVE_ZIPS=true
shift
;;
--help|-h)
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " --rm-zips, -rm Remove zip files after extraction (default: keep them)"
echo " --help, -h Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use --help for usage information"
exit 1
;;
esac
done
# Extract point clouds
CHUNK_COUNT=$(ls pcd/chunk_*.zip 2>/dev/null | wc -l)
if [ "$CHUNK_COUNT" -eq 0 ]; then
echo "No chunk zip files found in pcd folder!"
exit 1
fi
# Extract point clouds
for i in $(seq 1 $CHUNK_COUNT); do
# Format the number with leading zero (01, 02, etc.)
chunk_num=$(printf "%02d" $i)
echo "Extracting chunk $chunk_num"
unzip -j pcd/chunk_$chunk_num.zip -d pcd/
done
echo ""
echo "All point clouds extracted!"
# Extract layouts
echo "Extracting layouts"
unzip -j layout/layout.zip -d layout/
echo "All layouts extracted!"
# Interactive prompt to remove zip files
if [ "$REMOVE_ZIPS" = false ]; then
echo ""
read -p "Do you want to remove the zip files? (Y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
REMOVE_ZIPS=true
fi
fi
# Remove zip files if requested
if [ "$REMOVE_ZIPS" = true ]; then
echo "Removing zip files..."
rm -f pcd/chunk_*.zip
rm -f layout/layout.zip
echo "Zip files removed!"
else
echo "Zip files kept."
fi
|