2022-01-23 01:34:48 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
outfolder="bilder/pvv-photos"
|
2022-01-25 09:05:34 +01:00
|
|
|
folders=$(ssh pvv@microbel.pvv.ntnu.no -i /home/pvv/c/pvv/.ssh/photofetcher 'find /home/pvv -maxdepth 3 -name "pvv-photos" 2>/dev/null')
|
2022-01-24 00:22:14 +01:00
|
|
|
unamefile="usernames.txt"
|
|
|
|
> $unamefile # Empty the file
|
2022-01-23 01:34:48 +01:00
|
|
|
|
|
|
|
for imgfolder in $folders; do
|
|
|
|
user=$(echo $imgfolder | cut -d "/" -f5)
|
2022-01-24 00:22:14 +01:00
|
|
|
realname="$(getent passwd $user | cut -d ':' -f 5)"
|
|
|
|
echo "$user:$realname" >> $unamefile
|
2022-01-23 01:34:48 +01:00
|
|
|
destination="$outfolder/$user"
|
|
|
|
mkdir -p $destination
|
2022-01-24 00:22:14 +01:00
|
|
|
rsync -rtvz --delete "$imgfolder/" "$destination" # Copy and keep timestamps
|
2022-01-23 01:34:48 +01:00
|
|
|
done
|