1

I have hundreds of images in a folder in bridge. I have tagged them alternatively by colour. The first bunch as Yellow, the second as Blue the third as Yellow again and so forth. I want to copy each bunch in separate folders and rename the folder to the name of the first file in the folder. Is there a script that can automate this process?

Thank you!

  • i never tried Bridge but if your files are in windows explorer than i can make a script and please add some extra details like structure of your folder and etc :D – Mr.Online Jul 3 at 10:28
  • Hey Design Phoenix! Sorry for the late reply, I got caught up with a lot of work. So, my files are also in the windows explorer. I use them in Bridge to colour tag them. eg. I have, say 600 images in the folder named from 12-001, 12-002, 12-003...... till 12-600. I have to move the first 20 images in the first folder and name the folder 12-001(the folder name will be the name of the first file of the folder). Then I might have to move the next 12 images in the second folder and the name it 12-021. Then say I might have to move the next 8 images in the third folder, name it 12-033 and so on. – Ab Pro Aug 19 at 4:27
  • How I use Bridge is that I tag the first bunch with a colour tag. So all the images in the first bunch can be red, then the second bunch would be green, then the third will be red again and so on. Sometimes, in case of special files, I tag them red and yellow for one group and Green with special files as Blue. Bridge becomes a really easy tool for the colour tagging process while I am looking at the thumbnails. – Ab Pro Aug 19 at 4:30
  • What I am looking for, is a process to automate all of this. So that a script can identify the colour tags, and put them in alternate folders and also rename the folder as the name of the first file in it. Let me know if it is possible! Do let me know if you need more clarity on the work. And thank you for replying! :D – Ab Pro Aug 19 at 4:35
  • Forget about bridge!! this can be done easily by scripting along with any adobe software like photoshop etc! well lets just let me make a demo for script. it might not be accurate but just let me know in comment that what further enhancement it will need :D – Mr.Online Aug 19 at 5:02
0

Okay here is a most basic script

  • so basically you can run this script on any adobe cc product as far as I'm concerned but you don't even need it at all. just install ExendScript Toolkit from here, paste below code in estk and just click on that green play icon and it should work too if you don't have PS AI etc. but if you have photoshop then you can just save below code as "Anyname.jsx" and later from "File-Scripts-Browse" you can run the script too.

  • So main prerequisite are as following : Make sure you have only "png" files in your folder! and I assume your PNG sequence starts from 1200_00 (1st file must be 0 numbered else script won't work as you want! because it's just basic and needs much improvements)

  • Okay once you run the script you'll have to select the folder in which you have those images; and then once folder is selected then it will be asked to enter prefix (1200_) in your case; and then you can simply enter the file numbers like (5 and new folder will created with 5 images etc.) watch gif for more details :D

var x = Folder.selectDialog("","");
var z = x.getFiles ("*.png");
var fileLength = z.length;
var finalLength = fileLength;
var pattern = prompt ("What is your file pattern?", "", "Pattern");
var startcount = 0;
for(var i=0; i<fileLength; i++){
    var segment = prompt(finalLength + "files left; how much file you want to proceed?","","Enter File Numbers");
    if(parseInt(segment) > finalLength){
        alert(finalLength + "Files Left");
        segment = prompt("Enter less than" + finalLength,"","Final Chance");
    }
    var endcount = startcount + parseInt(segment);
    var value = parseInt(segment);
    finalLength = finalLength - value;
    main(startcount, endcount);
    if(finalLength<=0) break;
}
function main(start, end){
    var count = end - start;
    var newFlder = new Folder (x + "/" + pattern +  startcount);
    if(!newFlder.exists){
        newFlder.create();
    }
    for(var j=0;j<count;j++){
        var file = z[startcount];
        var trans = file.copy(newFlder + "/" + pattern +  startcount + ".png");
        startcount = startcount + 1;
    }
}

enter image description here

  • This is incredible! Thank you so much Design Pheonix :D Shall I test this out this week and let you know the directions we can go towards with this? Thank you again!! :D – Ab Pro Aug 23 at 3:07
  • Haha no problems at all; just let me know does that works in your case or not. CAUTION: please test script on backup folder haha – Mr.Online Aug 26 at 2:57
  • Hey Mr. Online! Thank you for the script It is amazing! And yes, works like magic too! :D So I had a few queries about the same. I guess if we can refine the code a little bit, we can make it work completely. Firstly, is it possible that the script reads all the color tags from Adobe Bridge and makes the folders through that distinction? That ways we won't have to give it a count every time it makes a folder. eg. as mentioned above, the first set of images would be tagged as red and the next as green, then red and so on. Can the script read these tags and make the folders accordingly? – Ab Pro Aug 29 at 6:22
  • Secondly, the script is also renaming the files as it copies them to the new folder. Is there a way that the original names remain? And lastly, there is some glitch while closing the script. The cancel button won't work and I would have to close the entire photoshop, just so to get the script to close. – Ab Pro Aug 29 at 6:25
  • not sure about bridge because I never tried bridge but I can give a try and will update my answer if possible :) sorry for glitchy code! – Mr.Online Aug 29 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.