From 2f998e05a34975b0f1d8d6a4bf2caa05ebe415c5 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sat, 4 Jun 2011 20:55:44 +0200 Subject: [PATCH] Symbolic link skipping --- gcp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcp b/gcp index 4ccd85a..1a33eb1 100755 --- a/gcp +++ b/gcp @@ -266,6 +266,9 @@ class GCP(): try: for filename in os.listdir(dirpath): filepath = os.path.join(dirpath,filename) + if os.path.islink(filepath) and not options.dereference: + debug ("Skippink symbolic dir: %s" % filepath.decode('utf-8','replace')) + continue if os.path.isdir(filepath): full_dest_path = os.path.join(dest_path,filename) self.__appendDirToList(filepath, full_dest_path, options) @@ -550,6 +553,12 @@ class GCP(): parser.add_option("--preserve", action="store", default='mode,ownership,timestamps', help=_("preserve the specified attributes")) + parser.add_option("-L", "--dereference", action="store_true", default=False, + help=_("always follow symbolic links in sources")) + + parser.add_option("-P", "--no-dereference", action="store_false", dest='dereference', + help=_("never follow symbolic links in sources")) + #parser.add_option("--no-unicode-fix", action="store_false", dest='unicode_fix', default=True, # help=_("don't fix name encoding errors")) #TODO