rsync Verzeichnisse ausschliessen

A

ArpO

Mitglied
Thread Starter
Dabei seit
08.07.2008
Beiträge
33
Reaktionspunkte
5
hallo,
versuche schon seit stunden verzeichnisse in der rsync sicherungen auszuschliessen.

hier erstmal das schript

Code:
!/bin/bash
/usr/bin/rsync -avz -E --link-dest="/Volumes/400GB_Backup/backup.01" --exclude-from /Volumes/Daten/Benutzer/arpo/Scripte/nicht_zu_sichern /Volumes/Daten/Benutzer/arpo /Volumes/400GB_Backup/backup.00

habe es auch schon mit --exclude-from=/Volumes/Daten/Benutzer/arpo/Scripte/nicht_zu_sichern

versucht.

und hier die nicht_zu_sichern datei
Code:
/Volumes/Daten/Benutzer/arpo/firefox/cache
/Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines
/Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines.localized

habe auch schon
/Volumes/Daten/Benutzer/arpo/firefox/cache/
/Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines/
/Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines.localized/

versucht, ohne ergebnis.

ist übrigens OS X 10.5.4
 
Hi,

bei mir sieht das so aus:

Code:
rsync -e "ssh -p 22" --exclude=tyake/Library/Caches --exclude=tyake/VMWARE --exclude=tyake/downloads -avzpogrltH /Users/tyake user@wasuachimmer.dyndns.org:/zfs/backup/mbp

/tyake
 

wenn mir der thread geholfen hätte, dann hätte ich nicht gepostet.

habe es mit --exclude-from=/Volumes/Daten/Benutzer/arpo/Scripte/nicht_zu_sichern

und

--exclude-from/Volumes/Daten/Benutzer/arpo/Scripte/nicht_zu_sichern

versucht.
und mit und ohne / in der datei nicht_zu_sichern am ende.
das verzeichnis für die virtuellen maschienen wird immer gesichert :(

ich habe ein deutsches OS X, die ordner lasse ich aber so ausschliessen wie pwd mit es anzeigt.
 
Das '-e "ssh -p 22"' kannst Du Dir schenken, da rsync standardmäßig ssh verwendet, wenn Quelle oder Ziel auf einem entfernten Rechner liegen und 22 der Standardzielport von ssh ist.
 
ist bei ihm ja auch auf einen anderen rechner.
bei mir aber nicht.
 
Soll ich jetzt die Manpage hierher kopieren?
man rsync schrieb:
FILTER RULES
The filter rules allow for flexible selection of which files to transfer (include) and which files to skip (exclude). The rules either directly specify include/exclude patterns or they specify a way to acquire more include/exclude patterns (e.g. to read them from a file).

As the list of files/directories to transfer is built, rsync checks each name to be transferred against the list of include/exclude patterns in turn, and the first matching pattern is acted on: if it is an exclude pattern, then that file is skipped; if it is an include pattern then that filename is not skipped; if no matching pattern is found, then the filename is not skipped.

Rsync builds an ordered list of filter rules as specified on the command-line. Filter rules have the following syntax:

RULE [PATTERN_OR_FILENAME]
RULE,MODIFIERS [PATTERN_OR_FILENAME]

You have your choice of using either short or long RULE names, as described below. If you use a short-named rule, the ',' separating the RULE from the MODIFIERS is optional. The PATTERN or FILENAME that follows (when present) must come after either a single space or an underscore (_). Here are the available rule prefixes:

exclude, - specifies an exclude pattern.
include, + specifies an include pattern.
merge, . specifies a merge-file to read for more rules.
dir-merge, : specifies a per-directory merge-file.
hide, H specifies a pattern for hiding files from the transfer.
show, S files that match the pattern are not hidden.
protect, P specifies a pattern for protecting files from deletion.
risk, R files that match the pattern are not protected.
clear, ! clears the current include/exclude list (takes no arg)

When rules are being read from a file, empty lines are ignored, as are comment lines that start with a "#".

Note that the --include/--exclude command-line options do not allow the full range of rule parsing as described above -- they only allow the specification of include/exclude patterns plus a "!" token to clear the list (and the normal comment parsing when rules are read from a file). If a pattern does not begin with "- " (dash, space) or "+ " (plus, space), then the rule will be interpreted as if "+ " (for an include option) or "- " (for an exclude option) were prefixed to the string. A --filter option, on the other hand, must always contain either a short or long rule name at the start of the rule.

Note also that the --filter, --include, and --exclude options take one rule/pattern each. To add multiple ones, you can repeat the options on the command-line, use the merge-file syntax of the --filter option, or the --include-from/--exclude-from options.

INCLUDE/EXCLUDE PATTERN RULES
You can include and exclude files by specifying patterns using the "+", "-", etc. filter rules (as introduced in the FILTER RULES section above). The include/exclude rules each specify a pattern that is matched against the names of the files that are going to be transferred. These patterns can take several forms:


  • if the pattern starts with a / then it is anchored to a particular spot in the hierarchy of files, otherwise it is matched against the end of the pathname. This is similar to a leading ^ in regular expressions. Thus "/foo" would match a file named "foo" at either the "root of the transfer" (for a global rule) or in the merge-file's directory (for a per-directory rule). An unqualified "foo" would match any file or directory named "foo" anywhere in the tree because the algorithm is applied recursively from the top down; it behaves as if each path component gets a turn at being the end of the file name. Even the unanchored "sub/foo" would match at any point in the hierarchy where a "foo" was found within a directory named "sub". See the section on ANCHORING INCLUDE/EXCLUDE PATTERNS for a full discussion of how to specify a pattern that matches at the root of the transfer.
  • if the pattern ends with a / then it will only match a directory, not a file, link, or device.
  • rsync chooses between doing a simple string match and wildcard matching by checking if the pattern contains one of these three wildcard characters: '*', '?', and '[' .
  • a '*' matches any non-empty path component (it stops at slashes).
  • use '**' to match anything, including slashes.
  • a '?' matches any character except a slash (/).
  • a '[' introduces a character class, such as [a-z] or [[:alpha:]].
  • in a wildcard pattern, a backslash can be used to escape a wildcard character, but it is matched literally when no wildcards are present.
  • if the pattern contains a / (not counting a trailing /) or a "**", then it is matched against the full pathname, including any leading directories. If the pattern doesn't contain a / or a "**", then it is matched only against the final component of the filename. (Remember that the algorithm is applied recursively so "full filename" can actually be any portion of a path from the starting directory on down.)
  • a trailing "dir_name/***" will match both the directory (as if "dir_name/" had been specified) and all the files in the directory (as if "dir_name/**" had been specified). (This behavior is new for version 2.6.7.)

Note that, when using the --recursive (-r) option (which is implied by -a), every subcomponent of every path is visited from the top down, so include/exclude patterns get applied recursively to each subcomponent's full name (e.g. to include "/foo/bar/baz" the subcomponents "/foo" and "/foo/bar" must not be excluded). The exclude patterns actually short-circuit the directory traversal stage when rsync finds the files to send. If a pattern excludes a particular parent directory, it can render a deeper include pattern ineffectual because rsync did not descend through that excluded section of the hierarchy. This is particularly important when using a trailing '*' rule. For instance, this won't work:

+ /some/path/this-file-will-not-be-found
+ /file-is-included
- *
This fails because the parent directory "some" is excluded by the '*' rule, so rsync never visits any of the files in the "some" or "some/path" directories. One solution is to ask for all directories in the hierarchy to be included by using a single rule: "+ */" (put it somewhere before the "- *" rule), and perhaps use the --prune-empty-dirs option. Another solution is to add specific include rules for all the parent dirs that need to be visited. For instance, this set of rules works fine:

+ /some/
+ /some/path/
+ /some/path/this-file-is-found
+ /file-also-included
- *

Here are some examples of exclude/include matching:

  • "- *.o" would exclude all filenames matching *.o
  • "- /foo" would exclude a file (or directory) named foo in the transfer-root directory
  • "- foo/" would exclude any directory named foo
  • "- /foo/*/bar" would exclude any file named bar which is at two levels below a directory named foo in the transfer-root directory
  • "- /foo/**/bar" would exclude any file named bar two or more levels below a directory named foo in the transfer-root directory
  • The combination of "+ */", "+ *.c", and "- *" would include all directories and C source files but nothing else (see also the --prune-empty-dirs option)
  • The combination of "+ foo/", "+ foo/bar.c", and "- *" would include only the foo directory and foo/bar.c (the foo directory must be explicitly included or it would be excluded by the "*")



 
Soll ich jetzt die Manpage hierher kopieren?

witzig!

hab das problem gefunden!
der ganze pfad den ich in nicht_zu_sichern angegeben habe ist für rsync kein muster! da soll mal ein normaler mensch drauf kommen. man meint es gut und gibt den genauen pfad an und dann "ist es zuviel des guten"!
nachdem ich vorne einen teil abgeschnitten habe klappt es.
 
  • Gefällt mir
Reaktionen: muellermanfred
Doch das geht. Vielleicht hängt es aber auch nur mit den nichtmaskierten Leerzeichen im Pfadnamen zusammen.
 
Doch das geht. Vielleicht hängt es aber auch nur mit den nichtmaskierten Leerzeichen im Pfadnamen zusammen.

dann sag mir dochmal bitte wie!

habe es versucht mit:


"/Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines/"
"/Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines.localized/"

oder

'/Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines/'
'/Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines.localized/'

oder

`/Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines/`
`/Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines.localized/`

und das ganze nochmal ohne / am ende.
alles ohne erfolg!


es scheint wirklich so zu sein, das rsync die muster immer nur auf den aktuellen pfad, nicht aber auch den "wirklichen" pfad anzuwenden scheint.
 
Zuletzt bearbeitet:
Bin mir grad nicht ganz sicher, aber maskiert man Leerzeichen nicht mit einem Backslash vor dem Leerzeichen?
 
Ganz einfach, Du hast die man-Page nicht gelesen oder nicht verstanden, denn da steht eindeutig: "- /foo" would exclude a file (or directory) named foo in the transfer-root directory

Dein Transfer-root-Verzeichnis ist /Volumes/Daten/Benutzer/arpo
Die auszuschließende Datei ist /Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines/
Ergibt: /Volumes/Daten/Benutzer/arpo/Documents/Virtual Machines/ /Volumes/Daten/Benutzer/arpo = /Documents/Virtual Machines/
Also muss in Deiner Exclude List dies stehen: /Documents/Virtual Machines/
Ich würde es schreiben als: /Documents/Virtual?Machines/
 
Zurück
Oben Unten