def removeFilesInDirectory(directoryPath):
 fileNames = os.listdir(directoryPath)
 for fileName in fileNames:
  filePath = os.path.join(directoryPath, fileName)
  os.remove(filePath)

def removeFilesInDirectory ( directoryPath ) : fileNames = os . listdir ( directoryPath ) for fileName in fileNames : filePath = os . path . join ( directoryPath , fileName ) os . remove ( filePath )
remove all the files in a directory .