In a bash script (Arch Linux) I have the following rsync command:
rsync –nvaAHX --inplace --delete-delay --exclude-from="/etc/$path1/exclude-list-$configName.txt" "$new_snap/" "$BACKUPDIR"
The rsync command fails with the following error:
rsync: --delete does not work without --recursive (-r) or --dirs (-d).
Of course, that message is misleading as "a" implies "r".
If I remove the option "--delete-delay" from the rsync command, I get this different error:
rsync: link_stat "/some/path/–aAHX" failed: No such file or directory (2)
The value shown at "/some/path" is the current working directory. If I change the current directory, that value in the error message changes as well. However, why the options "-aAHX" would be appended to any part of the path is confusing.
The computer is a fully updated Arch Linux system. I just rebooted it as well.
4.13.11-1-ARCH #1 SMP PREEMPT Thu Nov 2 10:25:56 CET 2017 x86_64 GNU/Linux
rsync program location:
# which rsync
/usr/bin/rsync
Here is the test script:
#!/bin/bash
path1=xyz
configName=root
new_snap=/.snapshots/1/snapshot
BACKUPDIR=/backup/$configName
echo "showing exclude file contents:"
cat "/etc/$path1/exclude-list-$configName.txt"
echo
echo rsync –nvaAHX --inplace --delete-delay --exclude-from="/etc/$path1/exclude-list-$configName.txt" "$new_snap/" "$BACKUPDIR"
rsync –nvaAHX --inplace --delete-delay --exclude-from="/etc/$path1/exclude-list-$configName.txt" "$new_snap/" "$BACKUPDIR"
Here are the contents of the file "/etc/$path/exclude-list-$configName.txt":
"dev/*"
"proc/*"
"sys/*"
"tmp/*"
"run/*"
"mnt/*"
"media/*"
"lost+found"
".trash*/*"
".Trash*/*"
Here is some testing without any script at all. I find it baffling.
# mkdir adir
# mkdir bdir
# touch adir/afile1
# touch adir/afile2
# ls -la adir/
total 0
drwxr-x--x 1 root root 24 Nov 12 02:21 .
drwxr-xr-x 1 user user 2080 Nov 12 02:28 ..
-rw-r----- 1 root root 0 Nov 12 02:21 afile1
-rw-r----- 1 root root 0 Nov 12 02:21 afile2
# ls -la bdir/
total 0
drwxr-x--x 1 root root 0 Nov 12 02:21 .
drwxr-xr-x 1 user user 2080 Nov 12 02:28 ..
# rsync -nva adir/ bdir
sending incremental file list
./
afile1
afile2
sent 93 bytes received 25 bytes 236.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
# rsync -nva /home/user/adir/ /home/user/bdir
sending incremental file list
./
afile1
afile2
sent 93 bytes received 25 bytes 236.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
# rsync –nvaAHX --inplace --delete-delay --exclude-from=/root/exclude-list-root.txt /home/user/adir/ /home/user/bdir/
rsync: --delete does not work without --recursive (-r) or --dirs (-d).
rsync error: syntax or usage error (code 1) at main.c(1567) [client=3.1.2]
# rsync –nvaAHX --inplace --delete-delay /home/user/adir/ /home/user/bdir/
rsync: --delete does not work without --recursive (-r) or --dirs (-d).
rsync error: syntax or usage error (code 1) at main.c(1567) [client=3.1.2]
# rsync –nvaAHX --inplace /home/user/adir/ /home/user/bdir/
rsync: link_stat "/home/user/–nvaAHX" failed: No such file or directory (2)
skipping directory .
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]
# rsync –nvaAHX /home/user/adir/ /home/user/bdir/
rsync: link_stat "/home/user/–nvaAHX" failed: No such file or directory (2)
skipping directory .
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]
# rsync –nva /home/user/adir/ /home/user/bdir/
rsync: link_stat "/home/user/–nva" failed: No such file or directory (2)
skipping directory .
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]
$path
as a variable name? And how is it set?$path1
.rsync
as an alias or shell function in your working environment, or is it the name of a script that you have written?