]> granicus.if.org Git - python/commitdiff
OK, here's a different way to implement the same thing -- this version
authorGuido van Rossum <guido@python.org>
Tue, 12 May 1998 22:45:43 +0000 (22:45 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 12 May 1998 22:45:43 +0000 (22:45 +0000)
also supports filenames with multiple spaces in their name :-)

Tools/scripts/ftpmirror.py

index d546f33a43d7600ae162219a9085fb7bcf3db59d..c73251a339fd5c953f3e13a86c14f6eb7699566c 100755 (executable)
@@ -132,17 +132,17 @@ def mirrorsubdir(f, localdir):
                        infostuff = ''
                else:
                        # Parse, assuming a UNIX listing
-                       words = string.split(line)
+                       words = string.split(line, None, 8)
                        if len(words) < 6:
                                if verbose > 1: print 'Skipping short line'
                                continue
-                       if words[-2] == '->':
+                       filename = words[-1]
+                       if string.find(filename, " -> ") >= 0:
                                if verbose > 1:
-                                   print 'Skipping symbolic link %s -> %s' % \
-                                                 (words[-3], words[-1])
+                                   print 'Skipping symbolic link %s' % \
+                                         filename
                                continue
-                       filename = string.join(words[8:])
-                       infostuff = words[5:]
+                       infostuff = words[-5:-1]
                        mode = words[0]
                skip = 0
                for pat in skippats: