<gh_stars>1-10
import shutil
import os

'''
    For the given path, get the List of all files in the directory tree 
'''
def getListOfFiles(dirName):
    # create a list of file and sub directories 
    # names in the given directory 
    listOfFile = os.listdir(dirName)
    allFiles = list()
    # Iterate over all the entries
    for entry in listOfFile:
        # Create full path
        fullPath = os.path.join(dirName, entry)
        # If entry is a directory then get the list of files in this directory 
        if os.path.isdir(fullPath):
            allFiles = allFiles + getListOfFiles(fullPath)
        else:
            allFiles.append(fullPath)
                
    return allFiles

dirName = './results'

listOfFiles = getListOfFiles(dirName)

def adaptFileName(filename):
    s = filename.split('/')
    return '{}.{}'.format(s[2], s[4]) 

for file in [x for x in listOfFiles if 'event' in x]:
    # result[file] = adaptFileName(file) 
    dst = 'event_files/{}'.format(adaptFileName(file))
    shutil.copyfile(file, dst)

import shutil
import os

'''
    For the given path, get the List of all files in the directory tree 
'''
def getListOfFiles(dirName):
    # create a list of file and sub directories 
    # names in the given directory 
    listOfFile = os.listdir(dirName)
    allFiles = list()
    # Iterate over all the entries
    for entry in listOfFile:
        # Create full path
        fullPath = os.path.join(dirName, entry)
        # If entry is a directory then get the list of files in this directory 
        if os.path.isdir(fullPath):
            allFiles = allFiles + getListOfFiles(fullPath)
        else:
            allFiles.append(fullPath)
                
    return allFiles

dirName = './results'

listOfFiles = getListOfFiles(dirName)

def adaptFileName(filename):
    s = filename.split('/')
    return '{}.{}'.format(s[2], s[4]) 

for file in [x for x in listOfFiles if 'event' in x]:
    # result[file] = adaptFileName(file) 
    dst = 'event_files/{}'.format(adaptFileName(file))
    shutil.copyfile(file, dst)
For the given path, get the List of all files in the directory tree # create a list of file and sub directories # names in the given directory # Iterate over all the entries # Create full path # If entry is a directory then get the list of files in this directory # result[file] = adaptFileName(file)