Links Move Unused

JavaScript for Adobe InDesign
Latest update 05/27/2017

The script is a housekeeping tool. Some of my projects are photo books with many images or similar documents with many placed links. These jobs often begin with, or accumulate during development, far more images than appear in the final product. When the project is done, I like to organize my files. It is possible to package the documents and produce links folders that contain strictly the links placed in each of the documents, but what about images not used? I don't want to throw them out, and they are still blended with the images that are used, within the original links folder. So I made this script to pull out unused images and put them into a separate “Links Not Used” folder.

  • Moves links not used to a selected folder
  • Examines links placed in the active document, a book file, or a folder of documents
  • Works with Mac and Windows
  • Uses system to move files, rather than copy and delete
  • All properties of moved files are preserved (modification time, etc.)
  • Also moves matching dotbar files on servers that split Mac resource and data forks

Free to download and use. Contributions of any amount are appreciated but not required.

Links Move Unused screen
Download
Links Move Unused

Instructions for use

The interface has three sections: Process, Links folder, and Destination folder. When the OK button is clicked, processing begins. Once complete, the user is notified of the number of files that were successfully moved.

Section 1: Process

Active Document — examines links placed in the document that is currently open and the top-most window if multiple documents are open.

Book — select an InDesign book file and links placed in all documents the book file references will be examined.

Folder — select a folder and links placed in all InDesign documents in the folder will be examined. Only files with the .indd extension are processed.

Section 2: Links folder

The folder that will be examined and compared against the links placed in the active document, selected book file, or selected folder of documents. This examination will determine which files are referenced by the selected document or documents, and which files have no reference appearing in any of the documents. Files that lack any reference are moved to the Destination folder.

The value will default to the folder named “Links” that exists alongside the selected document or documents, as is typical when InDesign packages a document. Click the button Folder… and navigate to any other desired folder.

Some notes:

How files are organized is any user’s choice, but that choice affects how this script is used. This is because my choice of file organization is the basis for the script’s behavior. After all, I wrote the script for my own use before sharing it here. The following includes comments regarding my choice of file organization, which is one opinion and yours could certainly differ. I only present the opinion for the purpose of making clear how I’ve designed the script and why.

If a project is comprised of multiple documents, whether gathered in a book file or not, and each document has its own links folder, the script will have to be run on each of those links folders separately. This can be tedious, and I wouldn’t consider it very automated, the typical goal for any script.

This script was not designed for files organized as described above, because it is not organization I consider optimum. Too fragmented, and it introduces the potential for duplicate images. Not a problem if all duplicates are identical, but if any one copy of an image has been revised, while others remain outdated, differing results in the final product are sure to cause upset.

I prefer a single links folder for a project, whether the project is comprised of a single InDesign layout document or hundreds of them. This eliminates accidental duplicates of any image. And this script was designed to work with this kind of file organization. The script will only have to be run once, targeting the sole links folder that belongs to the project.

Section 3: Destination folder

The folder to which unused links will be moved. The value will default to a folder named “Links not used” in the same folder containing the selected document or documents, typically alongside the selected Links folder. If the folder does not exist, it will be created. Click the button Folder… and navigate to any other folder, or create a new folder, named as desired, at a chosen location.

Download
Links Move Unused

For help installing scripts, see How to install and use scripts in Adobe Creative Cloud applications.

IMPORTANT: by downloading the script you agree that the software is provided without any warranty, express or implied. USE AT YOUR OWN RISK. Always make backups of important data.