MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / create_tree

Function create_tree

tools/python-3.11.9-amd64/Lib/distutils/dir_util.py:80–97  ·  view source on GitHub ↗

Create all the empty directories under 'base_dir' needed to put 'files' there. 'base_dir' is just the name of a directory which doesn't necessarily exist yet; 'files' is a list of filenames to be interpreted relative to 'base_dir'. 'base_dir' + the directory portion of every f

(base_dir, files, mode=0o777, verbose=1, dry_run=0)

Source from the content-addressed store, hash-verified

78 return created_dirs
79
80def create_tree(base_dir, files, mode=0o777, verbose=1, dry_run=0):
81 """Create all the empty directories under 'base_dir' needed to put 'files'
82 there.
83
84 'base_dir' is just the name of a directory which doesn't necessarily
85 exist yet; 'files' is a list of filenames to be interpreted relative to
86 'base_dir'. 'base_dir' + the directory portion of every file in 'files'
87 will be created if it doesn't already exist. 'mode', 'verbose' and
88 'dry_run' flags are as for 'mkpath()'.
89 """
90 # First get the list of directories to create
91 need_dir = set()
92 for file in files:
93 need_dir.add(os.path.join(base_dir, os.path.dirname(file)))
94
95 # Now create them
96 for dir in sorted(need_dir):
97 mkpath(dir, mode, verbose=verbose, dry_run=dry_run)
98
99def copy_tree(src, dst, preserve_mode=1, preserve_times=1,
100 preserve_symlinks=0, update=0, verbose=1, dry_run=0):

Callers 1

Calls 5

sortedFunction · 0.85
mkpathFunction · 0.70
setFunction · 0.50
addMethod · 0.45
joinMethod · 0.45

Tested by 1