![](https://seccdn.libravatar.org/avatar/b72f250a4f5b7bc95f1e9b00f684ecc1.jpg?s=120&d=mm&r=g)
I have a shell script that I use to backup my main computer to hard drives connected to it. I edited it today to backup another computer over my Lan. This is the script: #!/bin/sh # backup.sh -- backup to a local drive using rsync # Directories to backup. Separate with a space. Exclude trailing slash! SOURCES="apollo@Linux:Test/" # Directory to backup to. This is where your backup(s) will be stored. TARGET="/data1/LinuxBackup" EXCLUDE_FILE="/home/apollo/rsync_exclude_file" # Comment out the following line to disable verbose output VERBOSE="-v" ########################### if [ -f $EXCLUDE_FILE ]; then EXCLUDE="--exclude-from=$EXCLUDE_FILE" fi for source in $SOURCES; do if [ ! -d $TARGET/$source ]; then mkdir -p $TARGET$source fi rsync $VERBOSE $EXCLUDE -avz -e ssh --delete $source/ $TARGET/ done This works. It puts a copy of the test file in /data1/LinuxBackup. It also produces a directory called: 'LinuxBackupapollo@Linux:Test' in /data1 that I don't want. When I run the script with: for source in $SOURCES; do if [ ! -d $TARGET/$source ]; then mkdir -p $TARGET$source fi commented out, it doesn't work so well. I get output like this: # sh backup2_remote3.sh building file list ... [sender] expand file_list to 131072 bytes, did move [sender] excluding directory dev because of pattern /dev/ [sender] excluding directory mnt because of pattern /mnt/ [sender] expand file_list to 262144 bytes, did move [sender] expand file_list to 524288 bytes, did move [4]+ Stopped sh backup2_remote3.sh How should I modify this script to not produce the 'LinuxBackupapollo@Linux:Test' folder in /data1? Thanks, Jerome