No announcement yet.

Need: Script to traverse folders + allow file renaming

  • Filter
  • Time
  • Show
Clear All
new posts

  • Need: Script to traverse folders + allow file renaming

    Suppose I wanted to do in a script the functional equivalent of File > Automate > Batch...

    a. Source: Use all subfolders
    b. Destination: Save and close

    c. engage the File Renaming option to change the processed file name

    You can do a) and b) within Batch, but not c), too.

    - - - - - - - -

    In real ugly pseudocode, something like...

    - - - - - - - -

    Top_level_folder = "\My Documents"

    Open Top_level_folder;
    Number_of_files_read = 0;

    Do until all files processed;

    Open file (traverse multiple, nested folders; read all files taking into consideration some folders may be empty)

    Number_of_files_read = Number_of_files_read + 1

    \\Do something to the file [I can do this via called action]

    New_filename = original_filename + "-" + Number_of_files_read + "-thumbnail"

    Save as New_filename
    * in the folder from which the file was read
    * file format = .jpg
    * compression=10
    * If duplicate, save over the top of it.

    Close file

    End do;

    = = = = = = = = =

    Don't need a GUI or input dialog to specify high level folder. Ditto for new file name constants. I can tweek the .js code to do that.

    PS7 preferred.

    CS optional since I'll be a CS2 user someday.

    Any takers?


  • #2
    Hey Danny,

    I'm pretty sure what you want is described in the last chapter of Fraser's ACR w/ CS2. That is if I came close to following your "pseudocode".


    • #3
      Hi, Robert:

      That gives me a reason to check out the new edition. Thanks for the tip.



      Related Topics


      • clickin
        I need a Script like a mail merge!
        by clickin
        I need a script like a mail merge! I want to rename my files to the names of the students. I have a excel spread sheet with all the names and the file names. I need a script to rename the camera file name to the person's name.jpg. I hope that was clear. Does anyone have any ideas? I am new to...
        02-16-2005, 09:25 AM
      • JohnR
        Actions/Batches are Driving Me Insane
        by JohnR
        I make an action to open a pict file, crop it, "save to web" as low rez jpeg, named "26a.jpeg", save it, then close original file with no save. Stop making the action.

        So I go to do a batch on a folder of picts all the same size and rez.

        I tell the batch...
        08-26-2004, 03:32 PM
      • memphishooter
        file browser
        by memphishooter
        I have PS7 in a new machine, with Windows, giving me 16 x 9 screen. Thing is, I like to bring files into PS7, set em up in file browser and batch rename, so the files are sequential, and the file #'s are only two digits long. I can't find the triangle that I used to see when I had this exact same program...
        01-28-2010, 04:36 PM
      • babedieboe
        open the file browser by script?
        by babedieboe
        Is there any way to open the internal file browser by scripting? JS or VB.
        I hate to open it f.e. in VB with a commondialog or in JS with the File
        object..... i want the internal file browser to open........
        01-12-2005, 01:51 AM
      • Jeffrey2134
        JPG when saved not readable in file folder
        by Jeffrey2134
        Using Adobe Element 5 I bring in a photo and make my changes. Then click on the X to close the editor, and when asked to save... I rename it and save the file to another folder or same folder as a JPG. When I go to look at it it has no extension that I can see and will not let me see it. I've been doing...
        09-10-2007, 06:37 PM