34 lines
919 B
Bash
Executable File
34 lines
919 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e # Exit immediately if a command exits with a non-zero status.
|
|
|
|
DATA_DIR="data"
|
|
TARGET_DIR="$DATA_DIR/PennFudanPed"
|
|
ZIP_FILE="$DATA_DIR/PennFudanPed.zip"
|
|
URL="https://www.cis.upenn.edu/~jshi/ped_html/PennFudanPed.zip"
|
|
|
|
# 1. Check if the target directory already exists
|
|
if [ -d "$TARGET_DIR" ]; then
|
|
echo "Dataset already exists at $TARGET_DIR. Skipping download."
|
|
exit 0
|
|
fi
|
|
|
|
# 2. Create the data directory if it doesn't exist
|
|
mkdir -p "$DATA_DIR"
|
|
echo "Created directory $DATA_DIR (if it didn't exist)."
|
|
|
|
# 3. Download the dataset
|
|
echo "Downloading dataset from $URL..."
|
|
wget -O "$ZIP_FILE" "$URL"
|
|
echo "Download complete."
|
|
|
|
# 4. Extract the dataset
|
|
echo "Extracting $ZIP_FILE to $DATA_DIR..."
|
|
unzip -q "$ZIP_FILE" -d "$DATA_DIR" # -q for quiet mode
|
|
echo "Extraction complete."
|
|
|
|
# 5. Remove the zip file
|
|
rm "$ZIP_FILE"
|
|
echo "Removed $ZIP_FILE."
|
|
|
|
echo "Dataset setup complete in $TARGET_DIR." |