split-gallery-videos

This commit is contained in:
Danilo Reyes 2024-11-03 15:42:00 -06:00
parent 455224c045
commit 5ce47cc45f

23
split-gallery-videos.sh Executable file
View File

@ -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."