Script to fix texture nodes after importing a file
Loop the materials collection



Loop over the material collection. Need only do this once per material, rather than for each object that uses the material. 

Search for links from tex node to bsdf and from color to alpha socket, if found unlink old, make a new link, and print the image name.

import bpy

for m in bpy.data.materials:
    if not m.use_nodes:
        continue
    print(material.name)
    node_tree = m.node_tree
    links = node_tree.links
    # list comprehension to find those links
    tex_ps_links = [l for l in links 
            if l.from_node.type == 'TEX_IMAGE' 
            and l.from_socket.name == "Color"
            and l.to_node.type == 'BSDF_PRINCIPLED'
            and l.to_socket.name == "Alpha"]

    for l in tex_ps_links:
        # print tex node image
        texnode = l.from_node
        if texnode.image:
            print(texnode.image.name)
        else:
            print("No Image")

        from_socket = l.from_node.outputs["Alpha"]
        to_socket = l.to_socket
        # make the new
        links.remove(l)
        links.new(from_socket, to_socket)
        # remove the old


Blender scripting connect nodes

Also note this one, where it maps socket index to name.  When playing around with languages noticed the names can be in a different language, eg Color in Spanish will fail the node.outputs["Color"] name lookup.

https://blender.stackexchange.com/a/160069/15543

eg instead of name test used above, if we know a socket number eg "Sheen Tint" is 11 could look for l.to_socket == l.to_node.inputs[11] instead of l.to_socket.name == "Sheen Tint"