Jan Heitkötter wrote:
> ich möchte mit rsync ein Skript basteln, das Dateien vom lokalen Rechner
> auf ein NAS schiebt. Mit dem Skript soll der Bestand an Digitalfotos auf
> dem NAS auf den Stand gebracht werden, der auf dem Rechner aktuell ist.
> Das NAS erzeugt automatisch Vorschaubilder und legt diese in
> Unterverzeichnissen (mit festem Namen) ab.
>
> Herausforderung: Die Verzeichnisse mit den Vorschaubildern sollen nicht
> gelöscht werden. Im Normalfall würde rsync diese löschen, da sie lokal
> nicht vorhanden sind. Wie bekomme ich das mit rsync auf die Reihe?
>
> Mit --exclude kann ich m.W. nur Dateien/Verzeichnisse an der /Quelle/
> aussteuern. Hier soll ein Verzeichnis beim /Ziel/ ignoriert werden.
Möglicherweise hilft das:
$ cd /tmp
$ mkdir -p rsync/{1,2/bar}
$ cd rsync
$ touch 1/foo
$ touch 2/bar/baz
$ rsync -vr --delete 1/* 2/
sending incremental file list
foo
sent 65 bytes received 31 bytes 192.00 bytes/sec
total size is 0 speedup is 0.00
$ ls -lR 2
2:
total 4
drwxr-xr-x 2 **** **** 4096 Mär 18 03:29 bar
-rw-r--r-- 1 **** **** 0 Mär 18 03:29 foo
2/bar:
total 0
-rw-r--r-- 1 **** **** 0 Mär 18 03:29 baz
$ rsync --version
rsync version 3.0.9 protocol version 30
Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.
Web site:
http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, xattrs, iconv, symtimes
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
Falls nicht, könnte die Option -f helfen.
--
PointedEars
Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.