From fb5b66f12bc74ff935d73db506886d0f4b90d6d8 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sun, 23 Jan 2022 01:34:48 +0100 Subject: [PATCH] Script for fetching pictures from home folders --- .gitignore | 3 ++- www/galleri/fetchPics.sh | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 www/galleri/fetchPics.sh diff --git a/.gitignore b/.gitignore index f72028b..7357883 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ /www/simplesaml composer.phar /www/galleri/bilder/slideshow/*.* -!/www/galleri/bilder/slideshow/.gitkeep \ No newline at end of file +!/www/galleri/bilder/slideshow/.gitkeep +/www/galleri/bilder/pvv-photos/*.* \ No newline at end of file diff --git a/www/galleri/fetchPics.sh b/www/galleri/fetchPics.sh new file mode 100755 index 0000000..a9f9d95 --- /dev/null +++ b/www/galleri/fetchPics.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +outfolder="bilder/pvv-photos" +folders=$(find /home/pvv -maxdepth 3 -name 'pvv-photos' 2>/dev/null) + +for imgfolder in $folders; do + user=$(echo $imgfolder | cut -d "/" -f5) + destination="$outfolder/$user" + mkdir -p $destination + rsync -rvz --delete "$imgfolder/" "$destination" +done \ No newline at end of file