MCPcopy
hub / github.com/RUB-NDS/PRET / fswalk

Method fswalk

pjl.py:292–310  ·  view source on GitHub ↗
(self, arg, mode, recursive=False)

Source from the content-addressed store, hash-verified

290
291 # perform recursive function on file system
292 def fswalk(self, arg, mode, recursive=False):
293 # add traversal and cwd in first run
294 if not recursive:
295 arg = self.vpath(arg)
296 # add volume information to pathname
297 path = self.vol + self.normpath(arg)
298 list = self.dirlist(path, True, False, False, False)
299 # for files in current directory
300 for name, size in sorted(list.items()):
301 name = self.normpath(arg) + self.get_sep(arg) + name
302 name = name.lstrip(c.SEP) # crop leading slashes
303 # execute function for current file
304 if mode == "find":
305 output().raw(c.SEP + name)
306 if mode == "mirror":
307 self.mirror(name, size)
308 # recursion on directory
309 if not size:
310 self.fswalk(name, mode, True)
311
312 # ====================================================================
313

Callers 2

do_findMethod · 0.95
do_mirrorMethod · 0.95

Calls 7

dirlistMethod · 0.95
outputClass · 0.90
vpathMethod · 0.80
normpathMethod · 0.80
get_sepMethod · 0.80
rawMethod · 0.80
mirrorMethod · 0.80

Tested by

no test coverage detected