juannat7 commited on
Commit
a9947fe
·
verified ·
1 Parent(s): da37f24

Upload process.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. process.sh +43 -0
process.sh ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Base URL for the chunked files
4
+ BASE_URL="https://huggingface.co/datasets/juannat7/SLAMS/resolve/main/$1/"
5
+
6
+ # The base name of the files (without extension)
7
+ BASE_NAME="$1_chunks"
8
+
9
+ # Extension for the chunked files
10
+ EXTENSION="tar.gz"
11
+
12
+ # Download all chunked files
13
+ for prefix in {a..z}; do
14
+ for suffix in {a..z}; do
15
+ FILE_NAME="${BASE_NAME}.${EXTENSION}.${prefix}${suffix}"
16
+ wget "${BASE_URL}${FILE_NAME}" || break 2
17
+ done
18
+ done
19
+
20
+ # Combine the chunked files
21
+ echo "COMBINING CHUNKS, THIS MAY TAKE A WHILE..."
22
+ cat ${BASE_NAME}.${EXTENSION}.* > "$1".tar.gz
23
+
24
+ # Remove the chunked files
25
+ rm ${BASE_NAME}.${EXTENSION}.*
26
+
27
+ # Extract the combined file
28
+ echo "EXTRACTING FOLDER, THIS MAY TAKE A WHILE..."
29
+ if [ "$2" == "with_pigz" ]; then
30
+ echo "Use pigz for parallel decompression..."
31
+ pigz -dc "$1".tar.gz | tar -xf -
32
+ else
33
+ # Use standard tar for decompression
34
+ tar -xzf "$1".tar.gz
35
+ fi
36
+
37
+ # Remove the combined compressed file
38
+ rm "$1".tar.gz
39
+
40
+ # Rename folder
41
+ mv "$1"_tmp "$1"
42
+
43
+