0

I use rsync to backup my data to an external drive by running a bash script. In it, the instructions are as follows:

#!/usr/bin/env bash
#Backup
#-r : recursive
#--size-only : ignore timestamp, use size
#-t : transfer modif times
#-v : verbose
#--progress : show transfers as they happen
#--delete-before : files to be deleted are done so before transfers
#-u : update; skip newer files on target
#-L : follow symlinks
#
rsync -r --size-only --progress --delete-before -t -v -u -L /home/user/Desktop/backup/ /media/guajardo/BCKPDRV/jomdir/

On my Desktop directory backup I have symlinks to all the directories I want to sync. I recently moved everything in the external drive to the directory jomdir (it all used to be in the root dir. for this drive), and now when I run the script I get the error line 12: /media/user/BCKPDRV/jomdir: Is a directory. This didn't happen when everything was on the root dir. of the drive. However, when I run the above command on bash but replacing the full path by a relative path ( Desktop/... etc), it works; moreover, when I modify the script and use ~/Desktop/... etc, the error disappears and rsync works.

Any ideas on why this happens? Please: I do want to keep using rsync because I have several other scripts I use regularly for this sort of thing.

Thanks a lot!

EDIT: As I mentioned before, the rest of the script is just comments so I don't forget what each options does; nonetheless, here it is.

6
  • Is /home/user/Desktop/backup a symbolic link too?
    – Kusalananda
    Commented Nov 30, 2020 at 17:25
  • please show us your script it would be easier. Meanwhile isnt a / missing in the line 12?
    – BANJOSA
    Commented Nov 30, 2020 at 17:30
  • @Kusalananda No, the backup dir. contains symlinks but it is not itself one; @BANJOSA: the script is the instruction I posted, essentially; the rest of the lines are comments so I don't forget what each option does. Where do you say a backslash is missing? Commented Nov 30, 2020 at 17:45
  • line 12 of the script, it seems to me that should be /media/user/BCKPDRV/jomdir/ and not /media/user/BCKPDRV/jomdir
    – BANJOSA
    Commented Nov 30, 2020 at 17:58
  • There is a trailing slash in the original post. Commented Nov 30, 2020 at 20:28

1 Answer 1

3

The error you post: line 12: /media/user/BCKPDRV/jomdir: Is a directory is not an rsync error, it's a shell error. The shell thought that on line 12, the path above was to be executed and the error is saying that it can't do that. It's not feeding it as an argument to rsync as you expected.

For more help, you probably need to cut and paste the actual bash script into your question, not just the parts you think are relevant.

1
  • Right! It was an extra space I hadn't noticed! Thanks! Commented Dec 1, 2020 at 20:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .