confirm the user executing the commands has relevant permissions
please run and copy/paste the result of the following
ls -al Ubuntu_Documents.zip
ls -al $Backup_Directory/Ubuntu_Documents.zip
ls -al $Local_Backup_Dir/Ubuntu_Documents.zip
- add --verbose --dry-run to the rsync command
- show the output
this 'test' harness behaves as expected , you may want to test it on your host.
#!/bin/bash
Backup_Directory="./bkup/"
Local_Backup_Dir="./anotherbkup/"
ls -alR $Backup_Directory $Local_Backup_Dir
#make some working files
touch {1..3}{.txt,.doc,.rtf,.html,.png,.pdf,.odt,.ods,.odg,.csv,.xls,.jpg}
for file in [123].*; do echo "$file $(date) $RANDOM" >> $file; done
touch $Local_Backup_Dir/Ubuntu_Documents.zip #this will be the 'old' archive, so will be updated/replaced
sleep 5
zip -q -u Ubuntu_Documents.zip *.txt *.doc *.rtf *.html *.png *.pdf *.odt *.ods *.odg *.csv *.xls *.jpg
## ONLY copy file if it's newer than destination file
##
sleep 5
touch $Backup_Directory/Ubuntu_Documents.zip # make this 'newer' than the zip we've just created/updated
rsync --verbose --progress -r -u Ubuntu_Documents.zip $Backup_Directory # no change to existing file
rsync --verbose --progress -r -u Ubuntu_Documents.zip $Local_Backup_Dir # should get a new file
ls -alR Ubuntu_Documents.zip $Backup_Directory $Local_Backup_Dir
Sorry for the late response. My back and neck pain can get very intense.
The symptons include the following.
forgetfulness 2. minor accidents 3. difficulty finishing tasks and 4. difficulty with attention.
My script is working now, but I have no idea why.
My destination directory has plenty of space on my 2 Tb drive.
ls: cannot access './bkup/': No such file or directory
ls: cannot access './anotherbkup/': No such file or directory
touch: cannot touch './anotherbkup//Ubuntu_Documents.zip': No such file or directory
touch: cannot touch './bkup//Ubuntu_Documents.zip': No such file or directory
sending incremental file list
created directory ./bkup
Ubuntu_Documents.zip
18,265 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/1)
sent 18,370 bytes received 64 bytes 36,868.00 bytes/sec
total size is 18,265 speedup is 0.99
sending incremental file list
created directory ./anotherbkup
Ubuntu_Documents.zip
18,265 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/1)
sent 18,370 bytes received 71 bytes 36,882.00 bytes/sec
total size is 18,265 speedup is 0.99
-rw-rw-r-- 1 andy andy 18265 Nov 29 03:49 Ubuntu_Documents.zip
./anotherbkup/:
total 44
drwxrwxr-x 2 andy andy 4096 Nov 29 03:49 .
drwxrwxr-x 4 andy andy 20480 Nov 29 03:49 ..
-rw-rw-r-- 1 andy andy 18265 Nov 29 03:49 Ubuntu_Documents.zip
./bkup/:
total 44
drwxrwxr-x 2 andy andy 4096 Nov 29 03:49 .
drwxrwxr-x 4 andy andy 20480 Nov 29 03:49 ..
-rw-rw-r-- 1 andy andy 18265 Nov 29 03:49 Ubuntu_Documents.zip
./UnixHelp.sh: line 31: cyclist: command not found
./UnixHelp.sh: line 32: 18m: command not found
./UnixHelp.sh: line 34: This: command not found
------------------
(program exited with code: 127)
Press return to continue