Skip to main content
Participant
October 7, 2020
Answered

Re-link Multiple Files

  • October 7, 2020
  • 4 replies
  • 2518 views

I would like it if illustrator had the ability to relink multiple files at the same time like Indesign does.

 

I have a file setup with 30 linked pieces of art, if I wanted to relink all 30 with a new version, I would have to do one at a time. I mean I could select all, but I will still have to find the new version 30 times.  Indesign has a feature that groups links based on their file name and you can relink that group with another file, so its all done with one click.

 

Is there another way of doing this, without tricking Illustrator into thinking its missing the link, because thats the only time it allows you to "Apply to all missing links"

Correct answer Ton Frederiks

Illustrator will look for linked files in a folder with the name Links located in the same folder where the Illustrator file was saved.

So you could create a folder named Links, put your modified versions in there (they need to have the same name).

Delete or move the old version (so Illustrator cannot find those).

Open the Illustrator file and save.

4 replies

marcg68495176
Inspiring
June 18, 2024

In case you don't want to restart everytime you want to change all links to the same file at once, you can run this script, choose the link you want to replace, choose your new file, and it will replace any link sharing that name automatically. 

/**
 * This script replaces all linked files with the same name at one time in Adobe Illustrator.
 * It allows the user to select the link to replace from a list of current links using a drop-down menu
 * and then choose the new file from a dialog.
 */

function replaceAllLinksWithSameName() {
    var doc = app.activeDocument;
    var placedItems = doc.placedItems;
    var linkNames = [];

    // Collect all unique link names
    for (var i = 0; i < placedItems.length; i++) {
        var placedItem = placedItems[i];
        if (placedItem.file) {
            var fileName = placedItem.file.name;

            // Check if the fileName is already in linkNames
            var isUnique = true;
            for (var j = 0; j < linkNames.length; j++) {
                if (linkNames[j] === fileName) {
                    isUnique = false;
                    break;
                }
            }

            if (isUnique) {
                linkNames.push(fileName);
            }
        }
    }

    if (linkNames.length === 0) {
        alert("No linked files found in the document.");
        return;
    }

    // Create a dialog for link selection
    var dialog = new Window("dialog", "Select Link to Replace");
    dialog.orientation = "column";

    var dropdown = dialog.add("dropdownlist", undefined, linkNames);
    dropdown.selection = 0;

    var okButton = dialog.add("button", undefined, "OK");
    okButton.onClick = function() {
        dialog.close(1);
    };

    if (dialog.show() != 1) {
        return;
    }

    var oldFileName = dropdown.selection.text;
    var newFile = File.openDialog("Select the new file to replace " + oldFileName);

    if (newFile) {
        var count = 0;

        for (var k = 0; k < placedItems.length; k++) {
            var placedItem = placedItems[k];
            if (placedItem.file && placedItem.file.name === oldFileName) {
                placedItem.file = newFile;
                count++;
            }
        }

        alert(count + " links have been replaced.");
    } else {
        alert("Operation cancelled or no file selected.");
    }
}

replaceAllLinksWithSameName();
Maria3B
Participating Frequently
February 3, 2023

Wait. Hold up, are you saying that if I have 30 files in a folder that is not called "Links" I would have to relink every single one of them manually if the folder name or path changed?  

Ton Frederiks
Community Expert
Community Expert
February 3, 2023

No, there is a checkbox "Apply to All" for that.

DRock22
Inspiring
October 7, 2020

I have the same issue. We link low res files for proofing purposes and then relink high res when it goes to production. Would LOVE to be able to relink all the files in a document at the same time (without having to go to the linked oubject and select "relink" for every single one.). Would also love it if it put the name of the file in the window when trying to relink. Why is it blank!? 

Ton Frederiks
Community Expert
Ton FrederiksCommunity ExpertCorrect answer
Community Expert
October 7, 2020

Illustrator will look for linked files in a folder with the name Links located in the same folder where the Illustrator file was saved.

So you could create a folder named Links, put your modified versions in there (they need to have the same name).

Delete or move the old version (so Illustrator cannot find those).

Open the Illustrator file and save.

Participating Frequently
May 3, 2023

Very helpful, I'll now make sure this is my standard workflow practice from now on.