#! /etc/profiles/per-user/jawz/bin/bash # Source and destination directories SRC_DIR="/srv/server/btrfs/scrapping/JawZ/gallery-dl" DEST_DIR="/srv/server/btrfs/scrapping/JawZ/videos-dl" # Create destination directory if it doesn't exist mkdir -p "$DEST_DIR" # Find all the desired files and process them find "$SRC_DIR" -type f \( -name "*.mp4" -o -name "*.webm" -o -name "*.sfw" -o -name "*.m4v" -o -name "*.wav" -o -name "*.m4a" -o -name "*.ytdl" -o -name "*.mkv" \) | while read -r FILE; do # Get the relative path REL_PATH="${FILE#"$SRC_DIR"/}" # Create the destination directory structure DEST_PATH="$DEST_DIR/$(dirname "$REL_PATH")" mkdir -p "$DEST_PATH" # Move the file mv "$FILE" "$DEST_PATH/" done echo "Files moved successfully, preserving the directory structure."