From 5ce47cc45fb6a418b94aa73985e33bbe360ef232 Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Sun, 3 Nov 2024 15:42:00 -0600 Subject: [PATCH] split-gallery-videos --- split-gallery-videos.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 split-gallery-videos.sh diff --git a/split-gallery-videos.sh b/split-gallery-videos.sh new file mode 100755 index 0000000..e54de50 --- /dev/null +++ b/split-gallery-videos.sh @@ -0,0 +1,23 @@ +#! /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."