ysmao commited on
Commit
d9c5be3
·
verified ·
1 Parent(s): 190cff6

initial upload

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