I have a question about fnmatch function. Can fnmatch take a list return from a function for the pattern? Consider the following code.
import os
import sys
import time
import fnmatch
import shutil
from logalert import log
def copyLiveToPrompt():
#This function will copy all of the appropriate Voice Prompt files from LivePrompts #directory to promptDir based on promptList
try:
os.chdir(SourceDir)
for filename in fnmatch.filter(os.listdir(SourceDir), 'promptList':
shutil.copy(filename, "DestinationDir/new-%s" % filename)
return
except Exception as error:
log(logFile, 'An error has occurred in the copyLiveToPrompt function: ' + str(error))
raise
Thank you for your time!