New answers tagged rsync
0
I don't think this is possible without explicitly excluding the files on the receiving side as part of the rsync command. See the man page section for rsync: "PER-DIRECTORY RULES AND DELETE".
Without a delete option, per-directory rules are only relevant on
the sending side, so you can feel free to exclude the merge files
themselves without ...
0
If I correctly understood, the --exclude might be what you're looking for:
$ ls src dst
dst:
a.txt b.txt c.txt d.txt README.md
src:
c.txt
$ rsync --update --delete --recursive --exclude="d.txt" --exclude="README.md" src/ dst
$ ls src dst
dst:
c.txt d.txt README.md
src:
c.txt
2
It's highly implementation dependent. Most mv I have seen leave the half file at the destination and let it be up to you to clean up the mess. I have never seen mv remove the source before the destination were completely copied, but not necessarily sync'ed to disk.
When moving multiple files it's most common that mv start copying and first remove source ...
1
Ok, after several tries I sorted this up:
rsync -vaiz --delete --exclude=.svn/ --include='*.php' --include='*.js' \
--include='*/' --exclude='*' --prune-empty-dirs \
--filter "protect .svn/" /origin /destination
Thank you
1
1st attempt (didn't work)
You need to include the directories in addition to the files:
rsync -zavC --delete --include '*/' --include='*.php' --include='*.js' \
--exclude="*" /media/datacod/Test/ /home/lucas/Desktop/rsync/
2nd attempt
rsync -avzC --filter='-rs_*/.svn*' --include="*/" --include='*.js' \
--include='*.php' --exclude="*" --delete ...
0
While rsync doesn't let you set default options, you can create a wrapper script and put it higher up in your $PATH than the rsync binary.
This is is my rsync wrapper which lives in ~/bin/rsync
#!/bin/sh
# Set path to the rsync binary
RSYNC=/usr/bin/rsync
# Look for these exclude files
IGNORE_FILES=(~/.rsyncignore ./.gitignore ./.rsyncignore)
...
1
Edit: Sliced it up some more.
You might find this useful, from Debian Administration: An introduction to bash completion.
Complete script: /some/location/my_ssh_autocomplete_script (only meant as a short starter):
#!/bin/bash
_get_rsync_file_list()
{
# For test:
#local -a flist=("foo" "bar")
#printf "%s " "${flist[@]}"
# Or:
ls /tmp
...
1
You've included /models in the traversal, but none of its subdirectories. If a directory is excluded, rsync doesn't traverse it, so none of its contents can be included.
Use --include='*/' to include all subdirectories, and -m to not copy directories that would end up empty. For more information, see Rsync filter: copying one pattern only
4
Yes, of course you have to:
rsync -e 'ssh -p 222' ...
or:
RSYNC_RSH='ssh -p 222' rsync ...
Alternatively, you can specify in ~/.ssh/config that ssh connections to that host are to be on port 222 by default:
Host that-host
Port 222
2
The following rsync command executed on the local machine lists the files that exist on the remote host but not the local host.
rsync -av --dry-run --delete somedir/ user@remote:~/somedir/
The --dry-run switch only lists the files, without actually doing something, the --delete switch in combination with -v (verbose) lists the files that would be deleted ...
2
Unison File Synchronizer does exactly that using the rsync algorithm for the heavy lifting. I use it daily.
1
If you already have ssh keys to do your rsync, you could issue a remote ssh command and list the files in the dir, then diff it with a copy from your local dir.
ssh user@remote.com ls -1 ~/foo > /tmp/remote.txt && ls -1 ~/foo > /tmp/local.txt && diff /tmp/remote.txt /tmp/local.txt
Extra credit, pipe the output of diff to colordiff ...
2
This has to do with the filesystem being used, not rsync itself. Assuming ext[234], look at extundelete. There are similar tools for other filesystems.
There is no guarantee that you will get the files back. The files will remain on disk once deleted, but the act of deleting is really marking the space that they occupy as being available to other files ...
0
Your --include option needs to take account of leading subdirectory names. Try using **.jpg instead: the rsync-specific ** operator matches slashes as well as other characters.
0
How can i get the status (Success/Failure)?
I have a shell file rsyncCommand.sh with code as below which generates RsyncLog.txt file. I want to add a column success/failure and check whether rsync was a success or a failure. In addition , want o send an email notification in case it was a failure.
#!/bin/bash
fileCreationPath="/u01/Oracle/SyncScriptFolder"
...
0
There's something fundamentally broken with your problem statement. Suppose that your servers are in synch, and then you create a file aaaa.jpg on Node 2. Should the next synchronization delete that spurious file from Node 2 (since it doesn't exist on Node 1, it must have been deleted), or should it copy the file to Node 1 (since it doesn't exist on Node 1, ...
3
rsync is not setup to do two way syncs. Without specific help (e.g. sync from the machine that was changed) and a lot of luck, it cannot do so.
The luck is needed so that changes are infrequent and far apart. If both Node1 and Node2 get changed before the next sync is started (from either machine), some change does get lost on sync.
See also this
3
First off /sys is a pseudo file system. If you look at /proc/filesystems you will find a list of registered file systems where quite a few has nodev
in front. This indicates they are pseudo filesystems. This means they exists
on a running kernel as a RAM-based filesystem. Further they do not require a
block device.
$ cat /proc/filesystems
nodev sysfs
...
8
Rsync has code which specifically checks if a file is truncated during read and gives this error — ENODATA. I don't know why the files in /sys have this behavior, but since they're not real files, I guess it's not too surprising. There doesn't seem to be a way to tell rsync to skip this particular check.
I think you're probably better off not rsyncing /sys ...
0
Might be related, but extended attribute calls will fail on sysfs:
[root@hypervisor eth0]# lsattr address
lsattr: Inappropriate ioctl for device While reading flags on address
[root@hypervisor eth0]#
Looking at my strace it looks like rsync tries to pull in extended attributes by default:
22964 <... getxattr resumed> , 0x7fff42845110, ...
Top 50 recent answers are included



