changeset 46:dda2195dc9f4

Symbolic link skipping
author Goffi <goffi@goffi.org>
date Sat, 04 Jun 2011 20:55:44 +0200
parents 97384a79043d
children 99da6ef26d26
files gcp
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gcp	Sat Jun 04 20:32:50 2011 +0200
+++ b/gcp	Sat Jun 04 20:55:44 2011 +0200
@@ -266,6 +266,9 @@
         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 @@
         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