-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclone.sh
More file actions
31 lines (23 loc) · 773 Bytes
/
clone.sh
File metadata and controls
31 lines (23 loc) · 773 Bytes
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
#!/usr/bin/env bash
set -e # Exit on error
CSV_FILE="project_list.csv"
if [[ ! -f "$CSV_FILE" ]]; then
echo "[ERROR] File not found: $CSV_FILE"
exit 1
fi
# Create projects directory if it doesn't exist
PROJECTS_DIR="./projects"
mkdir -p "$PROJECTS_DIR"
echo "[INFO] Extracting GitHub links from $CSV_FILE..."
# Read file line by line and clone repositories
while IFS= read -r REPO; do
REPO_NAME=$(basename "$REPO")
# Clone only if repo does not already exist
if [[ -d "$PROJECTS_DIR/$REPO_NAME" ]]; then
echo "[INFO] Repository '$REPO_NAME' already cloned. Skipping..."
else
echo "[INFO] Cloning '$REPO_NAME' into $PROJECTS_DIR..."
git clone "$REPO" "$PROJECTS_DIR/$REPO_NAME"
fi
done < "$CSV_FILE"
echo "[INFO] All repositories cloned."