I am running a script that attempts to recursively run through a folder of files and count how many of the given file types there are. It works swimmingly when there are no SPACES in the folder name. Why is this? What is a good way to fix this? Thank you!
import os
import fnmatch
def getPath():
path = raw_input("Drag file/enter filepath here: ")
return path
def convert():
patterns = ['*.wav', '*.aif', '*.aiff', '*.flac', '*.alac']
count = 0
for index in patterns:
for root, dirs, files in os.walk(rootPath):
for filename in fnmatch.filter(files, index):
inputName = os.path.join(root, filename)
print inputName
count = count + 1
print count
rootPath = getPath()
convert()