File is not copied to a valid directory

Ubuntu_Documents.zip is not being copied to Local_Backup_Dir?

/home/andy/Backup/Ubuntu_Mate_20.04/ does exist.

Other files are being copied to that directory.

Can someone offer some things I can check?

Thanks.

Backup_Directory="/media/andy/Maxtor/Backup/"
Local_Backup_Dir="/home/andy/Backup/Ubuntu_Mate_20.04/"

cd $DOCS
touch Blank.odt
zip -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
##
rsync --progress -r -u Ubuntu_Documents.zip $Backup_Directory
rsync --progress -r -u Ubuntu_Documents.zip $Local_Backup_Dir

has this just started happening or is it new ?

please show

  • directory permissions
  • 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

thks

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

This code works.

I did something similar to what you have by using a touch command to create a new file.

I compared this with my original post, and the only change is the addition of the touch command?

Backup_Directory="/media/andy/Maxtor/Backup/"
Local_Backup_Dir="/home/andy/Backup/Ubuntu_Mate_20.04/"
DOCS="/home/andy/Documents" # shell variable

cd $DOCS
touch Blank.odt
zip -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
##
rsync --progress -r -u Ubuntu_Documents.zip $Backup_Directory
# for some reason, this is not working?
rsync --progress -r -u Ubuntu_Documents.zip $Local_Backup_Dir
sleep 5

Does this mean it's working now?

( You haven't supplied the outputs initially requested so it's nigh on impossible to give a definitive response/ reason why it wasn't copied ...
)

Was/ is there enough space for the copy to succeed?

Sorry for the late response. My back and neck pain can get very intense.

The symptons include the following.

  1. 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