PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

using rsync if file size differs

Go down

using rsync if file size differs Empty using rsync if file size differs

Post by jamied_uk 17th January 2023, 15:56

Code:
find /mnt/web_backup/* -type f -printf '%s %p\n' | while read size file; do
    if [ ! -f /var/www/${file##*/} ] || [ $(find /var/www/${file##*/} -printf "%s") -ne $size ]; then
        sudo rsync -av --bwlimit=309714747392 "$file" /var/www/${file##*/}
    fi
done

this is for bash on linux
jamied_uk
jamied_uk
Admin

Posts : 2951
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum