update script

This commit is contained in:
2024-11-02 12:28:05 +07:00
parent 5868f608b0
commit bdf9737fc1
2 changed files with 53 additions and 7 deletions
+12 -7
View File
@@ -1,5 +1,5 @@
#!/bin/bash
set -x
# Create a temporary file to store the URLs
temp_file=$(mktemp)
@@ -7,9 +7,8 @@ temp_file=$(mktemp)
grep -o 'https://apps-assets.fit2cloud.com/dev/1panel/.*' link.txt > "$temp_file"
# Create a directory to store the downloaded files
if [ ! -d "$(dirname "$nextweb")" ]; then
mkdir -p nextweb
fi
mkdir -p nextweb
# Change to the downloads directory
cd nextweb
@@ -18,11 +17,17 @@ while IFS= read -r url; do
# Extract the path after the base URL
path=$(echo "$url" | sed 's|https://apps-assets.fit2cloud.com/dev/1panel/||')
# Create the directory structure
mkdir -p "$(dirname "$path")"
# Create the directory structure if it doesn't exist
if [ ! -d "$(dirname "$path")" ]; then
mkdir -p "$(dirname "$path")"
fi
# Download the file
wget -q "$url" -P "$(dirname "$path")"
filename=$(basename "$url")
wget -q "$url" -O "$filename"
# Move the file to the appropriate directory
mv "$filename" "$(dirname "$path")"
done < "$temp_file"
# Remove the temporary file