MCPcopy Create free account
hub / github.com/geekcomputers/Python / count_files

Function count_files

script_count.py:31–40  ·  view source on GitHub ↗
(
    path, extensions
)

Source from the content-addressed store, hash-verified

29
30
31def count_files(
32 path, extensions
33): # Start of the function to count the files in the scripts directory, it counts the extension when passed below
34 counter = 0 # Set the counter to 0
35 for root, dirs, files in os.walk(
36 path
37 ): # Loop through all the directories in the given path
38 for file in files: # For all the files
39 counter += file.endswith(extensions) # Count the files
40 return counter # Return the count
41
42
43def github(): # Start of the function just to count the files in the github directory

Callers 1

script_count.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected