download a file or all files in a directory

def download(name, options):
    """
    download a file or all files in a directory
    """
    dire = os.path.dirname(name) # returns the directory name
    fName = os.path.basename(name) # returns the filename
    fNameOnly, fExt = os.path.splitext(fName)

    dwn = 0

    if fileExists(fName, dire) and not fileExists((fNameOnly + '.srt'), dire): # skip if already downloaded
        if file_downloaded(download_file(fName, options.timeout, dire), fName, options.verbose):
            dwn += 1
    elif dirExists(name):
        for filename in os.listdir(name):
            if options.recursive:
                dwn += download(os.path.join(name, filename), options)
            else:
                if file_downloaded(download_file(filename, options.timeout, name), filename, options.verbose):
                    dwn += 1
    return dwn