Script to search and relink linked image files that were moved?

Good afternoon
My indesign product catalog has links with a lot of different folders around in my hard disk, not a single folder. And to keep my catalog up to date I must package it.
When I move my linked files in my computer because I change the folder structure or do some cleaning, my indd loses track of its linked files. Currently I need to relink one by one.
Therefore I would like to find a script which would scan the hard disk with the all broken links in mind to detect their new location and relink. Yes I am a lazy person.
Thanks for any clue,

Thanks so much! I will try soonest.
How does your script react in the unlikely case of duplicates?
Date: Thu, 18 Jun 2009 12:43:47 -0600
From: [email protected]
To: [email protected]
Subject: Script to search and relink linked image files that were moved?
At least your honest about your laziness.... Here's your reward:
Just a hint, don't select root of your volume, it will loop through every folder in existence, but key to this script is, if you know the general location, select into that folder hierarchy and the script will test for a relative path, otherwise, come back in a few days, and it will be finished.
~mike
var processed = 0
var skipped = 0
var updated = 0
if (app.documents.length > 0){
    if(app.activeDocument.links.length > 0){
        var mydoc = app.activeDocument;
        var mylinks = mydoc.links;
        var myRoot = Folder.selectDialog("Choose the volume or server where assets are located", undefined, false);
        main();
else
{ alert("No Links present")
else{alert("No Documents Open")
function main(){
    if(myRoot != null){
        for(var i = 0; i < mylinks.length ; i++){
            if(mylinks.item(i).status == LinkStatus.linkMissing){
                    var linkdata= mylinks.item(i).filePath;
                    var my_result = linkRepair(linkdata);
                        if (my_result == false){
                            var filetype = "." + mylinks.item(i).linkType;
                            var mysearch =   search(linkdata, filetype);
                                if(mysearch != undefined){
var myswitch = confirm(mylinks.item(i).name + " has been found in a different location, Relink and Update?", "Relinker")
                                        if(myswitch){
                                            mylinks.item(i).relink(File(mysearch));
                                            mylinks.item(i).update();
                            else{
                                alert("" + mylinks.item(i).name " was not found\nFolders processed: "processed + "\nFiles skipped: "+ skipped)
                        else{ alert( my_result + " has been found");
                            mylinks.item(i).relink(File(my_result));
function linkRepair(linkdata){
var mypath = linkdata.split(":")
        my_status = analyzePath(mypath)
        if(my_status == true){alert("UPDATED");
                updated++       
    return my_status
function analyzePath(mypath){
var num = mypath.length ;
for(var i = 0; i < num-1; i++){
    mypath.shift()
    var newpath = pathRebuild(mypath)
    newpath = (myRoot + newpath)
        if(File(newpath).exists){
            return newpath
    return false
function pathRebuild(pathArray){
var solidPath = ""
    for(var i = 0; i < pathArray.length ; i++){
        solidPath +=  "/" + pathArray+ ;
    return solidPath;
function search(linkdata, filetype){
    var mypath = linkdata.split(":")
    var mylink = mypath.pop();
    var OK = confirm("Relative Path does not exist, search folder hiearchy for file?", true, "File Scanner")
    if(OK){
var myscanresult = getfiles(mylink, myRoot)
return myscanresult
function getfiles(mylink, myBase){
myBase = Folder(myBase);
var files = myBase.getFiles("*")
for(var i = 0; i < files.length; i++){
try{
var foldertest = files+.getFiles();
processed++
var myfile =     File(files+ + "/" + mylink)
    if(myfile.exists == true){
        return myfile
        break;
    else{
    var myscan = getfiles(mylink, Folder(files+))    
        if(myscan != undefined){
        return myscan
        break;
catch(myerror){
    skipped++
>

Similar Messages

  • How can I enable FTP on the DMP and How can I FTP to it and then remove the files that were deployed to the DMP flash?

    How can I enable FTP on the DMP and How can I FTP to it and then remove the files that were deployed to the DMP flash? My platform of DMS is 5.2.2

    Hi Temur, ok. I do the above procedure and it worked fine
    Now, I have other question?
    How can I reproduce any file (for example: a video, an url page, an image), that is in the flash of DMP?
    Índice de ftp://172.17.15.22/tmp/ftproot/tmp/ftproot/tmp/ftproot/usb_1/
    Subir al directorio superior.
    Nombre Tamaño Última modificación
    Sample Videos.lnk
    1 KB
    17/06/2011
    06:25:00 a.m.
    deployment
    29/06/2010
    04:14:00 a.m.
    lost+found
    25/02/2010
    12:00:00 a.m.
    video futbol en la playa.mp4
    1390 KB
    29/06/2010
    01:08:00 a.m.
    videofutbol.mp4
    1390 KB
    29/06/2010
    01:38:00 a.m.
    I like, that el DMP when loss conectivity with DMM, It display at the LCD screen, the video named videofutbol.mp4, this video As I show in the picture above, already in the flash of DMP.
    I appreciate your early response.
    Thanks

  • Files that were moved are still displaying in old location.

    Hello,
    I was recently doing some reorganization of some files in my iCloud account in Finder (In the iCloud tab). When I went to sign into iCloud.com the next day and go to iCloud Drive, for some reason the images that I had moved the day before were still in their old locations. The day before, I also rearranged some folders and made some new ones. Those were updated when I went to iCloud.com, but the images were still there. Here are some screen shots showing what my Finder looks like versus iCloud.com, as of right now. (I do realize that there are some extra apps displayed in iCloud.com, but just ignore those. Notice the images, like the first two listed on the screen)
    Notice the extra images on iCloud.com. Anybody know why this is happening? (I tried clearing my cache and cookies, but with no avail)
    Thanks in advance for the help!
    Alan

    Ok,
    I solved it. For some reason when I moved the event folder it created a second event folder in iMovie. This second event folder seemed to be overriding, or not allowing the original event folder to be read. So I moved all of the video files out of the original event folder and moved them to the new event folder.
    It's currently re-generating thumbnails for all the videos but this seems to have solved the problem.

  • Is there any way to recover the broken iMovie files, that were moved to a different unauthorized drive?

    I moved the iMovie projects and events folder to a regular harddrive. I know now, i the aftermath that it was a wrong thing to do, and i was wondering whether there are some way to recover the projects to use them in iMovie again?

    More details on why you think a regular harddrive was the wrong place to move a movie.
    What other kind of harddrive is there besides regular? Irregular?
    Allan

  • FM9/Win - Changing linked image file?

    I can do what I want to do in InDesign, QuarkXpress, and PageMaker, but for some reason this functionality appears to be absent in FrameMaker, which is utterly dain bramaged.
    I have a placed image in multiple places in a FrameMaker document. The image is placed by reference, not embedded. I now want to link to a different graphic (annual updates).
    Re-placing the image a zillion times is not an option, as the sizing and position is already set. I just want to change what FrameMaker is linking to.
    For the life of me, I cannot find where or even if, I can do this.
    The inelegant solution would be to simply move or rename the currently-linked-to file on the hard drive, and rename the new graphic to the same name as the old one. I do not like that option at all, as there are some instances in other documents that I still wish to link to the old image file.
    Is FrameMaker's link handling really this clumsy and archaic? In the other applications I refer to above, I would either go to a links palette and change the destination or right-click on an image and relink it. In FrameMaker, the "Object Properties" dialog appears to only report the location of the referenced file, not allow you to change it.
    What gives?

    Dan,
    To my knowledge, there is nothing in FrameMaker like there is in InDesign that allows you to relink an image directly, or even indirectly via a link list. I also have looked and not found anything. There is a link menu item somewhere but I have never figured out what it does.
    There is a plugin by Bruce Foster that is used to archive a book or document and its linked image files and text insets. When you run it, the plugin COPIES the book file and ALL the files associated with it into another folder that you specify, and then readjusts all the links among these files to point to the copied files. It puts all graphics files into one subfolder and all text insets into another. So, once you get your book where you want it, with no future changes, run the archive, and then use the files and book in the archive folder to print or do whatever you need to do in the future.
    The downside is that you have two sets of files to manage, but if the archived set is rarely or never edited or updated, then all is well.

  • Linking image files created in Mac are broken on PC and Vice Versa

    Hello,
    A fellow designer and I are sharing Illustrator files in the office but she is on a Mac and I am on a PC. Our linking image files are located in multiple folders on our company server, but whenever we open each other's files, all the links are broken and have to be relinked due to our different operating platforms. This can be very time consuming since the images are in different folders and there are many of them.
    Anybody know how to fix this PC/Mac problem without dropping all the linking files into the same folder as the .ai file? I'm not the IT guy so I don't think that rebuilding our server structure is an option either...would cause too much havoc around the office.
    Any help would be appreciated.

    Let me ask you something does this sound like a viable way to work?
    The way to do it is as you yourself suggest to work locally with all the files in one folder so you cannot break the links and that you know where the art is at all times.
    If the IT thinks this is a good way to work then let them create a script to save all linked files to a common live folder for the project so that both computers can find it.
    But from what you describe it is just looking for trouble and might be exactly what the IT wants trouble so they can extend their job. In which case ther is  no solution.

  • How can I create an icon that when clicked will open and maximize an image file?

    How do I create a icon that when clicked will open and maximize an image file?  I have tried to use the simple image widget with maximize upon tap/click - however I am can only size the image really small and put on the page.  I'd prefer to have a graphic that when clicked it simply opens up the image.  This is for a very simple question/answer book.   The user is suppose to look at a picture and locate something.  I want to put an 'Answer' graphic on the image and then the user can click the 'answer' graphic and it will open up the picture with the answer identified. 
    Is this possible?

    Have yiu tried the PopOver widget?  You can drop an image into it, maximise the image and the widgets window...But, you cannot get it full screen.
    With iBooks Author, you either learn to use what is available within the app, or look online for third party widgets to purchase which suit your project.

  • Import does not recognize old image files that have no extension

    Just discovered that the import facility does not see (or accept) old Mac image files that have no extension -- even if these files have a Mac "kind" that is an image such as "Adobe Photoshop file".
    You can manually add an extension to the file (and respond to an "are you sure?" dialog). Then the file will be seen and accepted.
    This is extremely dangerous (and painful to manually correct) since you think you are seeing all images in the import box, but you are not.
    In fact, I deleted huge image directories after having satisfactorally (I thought) imported them into Aperture many months ago. Most of the old extension-less files had been updated and did have extensions in later versions. However, I missed one important image and looked everywhere for it.
    By a miracle I had a backup of my image directories on a Power Book that I am retiring and finally noticed that the missing image was there just before deleting that directory too! I then figured out why this image (and many others) had not been imported. So, now I am going through manually and adding extensions.
    Does anyone know a better way -- to get Aperture to recognize extension-less images? If not, this needs to fixed in the next version as it is a disaster waiting to happen.
    Tom
    Dual 2.7Ghz G5 ATI Radeon X800 XT 2.5 GB ram   Mac OS X (10.4.6)  

    Well there's an idea...probably would need to go into Bridge <g> to do that most efficiently .. or Automator.
    It turns out that I already had added extension to most (but not all) images in my main image directory and so they got into Aperture alright. I just have to go through all the images in the backup I just found (where many did not get extensions) to find the ones that Aperture missed. So far, there have been just a couple more...
    The real problem is that Aperture should not be missing these, even if they are archaic. At the very least, Aperture's import should give a warning that there are files in a folder that it is not going to import AND is not even showing. Otherwise this is a serious gotcha!
    Tom

  • Is it possible to save a picture/image file that is within an iOS app?

    Is it possible to save a picture/image file that is within an app?
    The image in question cannot be shrunk, so using the iPhone built-in Screenshot function (by pressing both "Home" & "On/OffSleep/Wake" buttons simultaneously) only produces part of the image.
    Thanks.

    Generally in all Apple iOS apps, you can hold down on the image and the save image dialogue will pop up. Many third party developers adopt this method, but some also have other weird ways of doing it through menus. What appa re you trying to do this with?

  • I am looking for the image file that is used on the second monitor .

    Iam looking for the image file that is used on the second monitor when an app is in full screen mode.  not the NSTexturedFullScreenBackgroundColor.png as thats for the fullscreen background generally and not the one for the dashboard eather.
    I dont like the gray background on the second monitor that comes up when an app is in fullscreen mode and want to change it.
    Any help would be apreciated

    i typed in a load of stuff but its not there ill start again

  • HT4796 How can I take the files that were migrated from my PC to my Mac and add all those files to my current user instead of having 2 users?

    How can I take the files that were migrated from my PC to my Mac and add all those files to my current user instead of having 2 users? Having to log out just to sign in on a different user to access the files is absurd.
    Do I make all the files sharable to all the NOW users on the mac then just delete the files? Or can i erase my account that I made when starting up my new mac and then just use the one with the transferred files?
    I just dont want to have to og in and out of 2 different accounts .. Help please.         
    -Nina

    Sorry. /Users is a folder path. It would be similar to C:\Users (if that exists on Windows).
    So, in the Finder, select Computer from the Go menu.
    You'll see Macintosh HD, double-click that to open it.
    In there you'll see several folders. One is Users. That is where all the user Home folders exist. Select the other account's home folder and go to step 3.
    If you have any more confusion, please stop and ask. We'll get there.
    If you feel more comfortable, you can just log into that other account and move the files into /Users/Shared.
    Then, log into the account you wish to use and copy the files from the Shared folder and paste them into your Home folder, wherever they belong, Documents, Music, Pictures, etc.  That just takes a little more work. Transferring them into Shared, and then copying into your home sets the permissions on the files so that you won't have a problem accessing them later. The steps I provided just prevent you from having to do the double move, since you are not going to use the old account once you are done.
    Quick unix shorthand. If someone gives you a file path that begins with a /, that means the root of the hard drive, ie Macintosh HD (if you haven't renamed it). The path separator in unix is /, not \.
    A path that starts with ~/ means your Home folder, the one inside /Users named with your account name.

  • How can I access files that I moved from an older MacBook Pro to a newer one via Firewire and Migration assistant.  The files show up on the new MacBook but cannot be opened.  Thanks!

    How can I access files that I moved from an older MacBook Pro to a newer one via Firewire and Migration assistant?  The files show up on the new MacBook but cannot be opened.  Thanks!

    Get info then check permissions then add your curent user name (it was probably different on old Mac) and give your username full read/write permissions.

  • My desktop App for Story  has malfunctioned and I am no longer able to access the files that were on it, how do I save those documents and reinstall the app?

    I have a Story + desktop app for Adobe on my hard drive and it was supposed to sync up to my online app (or cloud) however it never did and now I cannot access my desktop app, nor the important files that were on it.
    __I.E. when I try to press the [Sign In] button, nothing happens.
    So I figured to find those files elsewhere, copy them somewhere safe then try re installing the app again.  However, I cannot find those files anywhere on my hard drive.

    Adobe Story stores its local files on the following location:
    On Windows,
    1. Open Windows Explorer and type '%appdata%' in the address bar
    2. Make a copy of 'com.adobe.AdobeStory.<some-number>' folder. This folder contains Story's local data.
    On Mac,
    1. Open Finder.
    2. From 'Go' Menu, open 'Go to folder'
    3. Type '~/Library/Preferences' and hit enter
    4. Make a copy of 'com.adobe.AdobeStory.<some-number>' folder. This folder contains Story's local data.

  • I recently thought I was updating my Safari browser. When completed, I put all those little files that were on the desktop into the trash. Now my trash is saying it can't be emptied because there are locked files and I don't know how to unlock them

    I recently thought I was updating my Safari browser. When completed, I put all those little files that were on the desktop into the trash. Now my trash is saying it can't be emptied because there are locked files and I don't know how to unlock them or get them out of my trash and they keep multiplying. And to make matters worse, I tried renaming them as pdf files thinking that might do the trick.

    oh boy ! I'd ask you if you knew what kind of files they were or where they came from, but I don't think you could help me a bunch. Try going to the Utilities folder and running Disk Utilities.  If you want to empty the Trash and it won't empty, go to the finder and choose "secure Empty trash". Worse case scenario-you may have to reinstall Snow Leopard, but I don't know what else to suggest. If you have a DVD of Snow Leopard, boot up from that,  and reinstall the OS. This will not touch the stuff you have on your Hard Drive, then you can update from 10.6 to 10.6.8, otherwise Onyx? Maybe those files are part of the OS which needs them to keep running.  if you hold down the Shift key on reboot, you can reboot in Safe mode and maybe you can take the files out of the trash that way
    good luck
    John B

  • How can I open and edit files that were developed and published by ftp to my host on my old macbook, which I can no longer access.

    How can I open and edit files that were developed and published via ftp to my host on my old macbook, which I can no longer access. The HD containing the files cannot be accessed. I want to be able to download the published files to be edited in iweb?

    You CAN'T download published files and then edit them in iWeb because iWeb can't open them - it has no import facility so is unable to open any html or css files - a previously published site.
    You can download these files yes, but you'll need to use them as a guide or to cut and paste text from there whilst you re-build your site in iWeb.
    The only other way is to download the files and then open them with an html editor such as TextWrangler or use one of the other web design programmes out there that is capable of importing html and css such as Dreamweaver of Flux 4.
    These are your only alternatives as iWeb can't import and if you want to continue to use iWeb, then you'll have to re-build your site from scratch.  If you do just remember to back up your domain.sites file this time around - it is found under your User/Library/Applicaion Support/iWeb/domain.sites.

Maybe you are looking for

  • How do I reset the e-printer's web embedded server network password?

    I have an HP Photosmart 7520 e-all in one. I use Windows 7.  I could tried to set a password in the EWS network tab. I could not change the user name so it remains "admin". I set the passwork and it seemed ok. But when I tried to log on again, it wou

  • Robotic noise instead of audio coming out

    Hi all I just set up my first iChat AV 'chat' with a friend... I have an iMac Intel Core Duo and she has a Macbook Power PC G4.... she doenst have a camera, but I do and she can see me when we connect, and she can hear me OK, but all I hear from her

  • How to use a custom jDialog ?

    Hi to everybody I have a little custom jdialog with only a jTextField inside. I'd like to know how to call it from another JFrame and then read the text which the user have written. Any advices ? Thank u in advance and greetings from Italy Andrea

  • No DVD player- what do I do ?

    We have an iMac G4, running 10.2.8 We want to install 10.4 Tiger but our machine does not have a DVD player installed. All the Tiger loads I have seen are DVD format so what can I do ? Is there a DVD player for the 10.2.8 ? or another way of loading

  • How Do I Customize the Key Combination to Cycle Through Windows in Reverse in all Applications?

    How do I customize the key combination to cycle through windows in reverse in all applications?  I want to be able to change the global setting for Command+~ (Cmd+Shft+`) to something more desireable.  I could NOT find a way to do this in Systems Pre