MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / find_files

Function find_files

modules/parallel_wavegan/utils/utils.py:17–36  ·  view source on GitHub ↗

Find files recursively. Args: root_dir (str): Root root_dir to find. query (str): Query to find. include_root_dir (bool): If False, root_dir name is not included. Returns: list: List of found filenames.

(root_dir, query="*.wav", include_root_dir=True)

Source from the content-addressed store, hash-verified

15
16
17def find_files(root_dir, query="*.wav", include_root_dir=True):
18 """Find files recursively.
19
20 Args:
21 root_dir (str): Root root_dir to find.
22 query (str): Query to find.
23 include_root_dir (bool): If False, root_dir name is not included.
24
25 Returns:
26 list: List of found filenames.
27
28 """
29 files = []
30 for root, dirnames, filenames in os.walk(root_dir, followlinks=True):
31 for filename in fnmatch.filter(filenames, query):
32 files.append(os.path.join(root, filename))
33 if not include_root_dir:
34 files = [file_.replace(root_dir + "/", "") for file_ in files]
35
36 return files
37
38
39def read_hdf5(hdf5_name, hdf5_path):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected