rh535 Posted April 14, 2024 Posted April 14, 2024 I have been trying to use ChatGPT to create an unraid user script that backups my files to another unraid server. It won't exclude my folders tho - any idea on how to fix it? #!/bin/bash # Source and Destination Directories declare -a SOURCE_DIRS=( "/mnt/user/APK" "/mnt/user/Computer_Apps" "/mnt/user/Documents" "/mnt/user/data" "/mnt/user/Photos" "/mnt/user/ss-recordings" ) DEST_DIR="/mnt/remotes/192.168.1.12_networkbackup/" # Folders to Exclude declare -a EXCLUDE_FOLDERS=( "/mnt/user/data/media/movies-4k/" "/mnt/user/data/media/tv-4k/" ) # Rsync Options RSYNC_OPTIONS="-avz --delete --progress" # Loop through each source directory for SOURCE_DIR in "${SOURCE_DIRS[@]}"; do # Exclude folders EXCLUDE_ARGS="" for EXCLUDE_FOLDER in "${EXCLUDE_FOLDERS[@]}"; do EXCLUDE_ARGS+=" --exclude=${EXCLUDE_FOLDER}" done # Run rsync rsync ${RSYNC_OPTIONS} ${EXCLUDE_ARGS} "${SOURCE_DIR}" "${DEST_DIR}" done Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.