Apple Script to rename images using CSV file

Hello, I have build a website using a Woocommerce for Wordpress. The site is going to have over 1200 images and they need to be renamed appropriately for each product. I've never used Apple Script before but after hours and hours of searching I have noticed people with similar issues have managed to solve the problem using AppleScript.
I have attached a screenshot of the CSV file first 20 files - also the images are all saved in a folder with the names _DSC7916 copy 2.jpg etc etc.
Hopefully my issue makes sense,

In applescript it goes something like this:
          this all assuming the CSV file is a plain text file with a comma delimiting
          the old and new filenames on a given line. If you have another structure
          you need to give specifics so this can be modified
set theCSVData to paragraphs of (read "/path/to/theCSVFile.csv")
set {oldTID, my text item delimiters} to {my text item delimiters, ","}
repeat with thisLine in theCSVData
          set {oldFileName, newFileName} to text items of thisLine
          tell application "System Events"
                    set name of file oldFileName of folder "path/to/folder of images" to newFileName
          end tell
end repeat
set my text item delimiters to oldTID
Note that I've made a lot of assumptions about your csv file, any or all of which may be wrong. please clarify as needed.

Similar Messages

  • Transfer using CSV-files

    Hello!  In our project we discussing about possibility to use CSV-files to transfer information.
    Can I use CSV in PI ?

    Hi,
    Yes you can. Use File adapter to read and do a file content conversion on it. By doing it the CSV format will be converted to XML format in PI
    Lot of weblgs are available on this
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/sundararamaprasad.subbaraman/blog/2005/12/09/making-csv-file-lookup-possible-in-sap-xi
    /people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file
    /people/swaroopa.vishwanath/blog/2005/06/24/generic-approach-for-validating-incoming-flat-file-in-sap-xi--part-1
    Regards
    Suraj
    Edited by: S.R.Suraj on Sep 30, 2009 9:18 AM

  • How do I stop Apple Script from leaving a Text.txt file with each image downloaded using Photo Downloader in Adobe Photoshop CS4_Bridge???

    I use Adobe Photoshop CS4_Bridge _Photo Downloader to import images from CF Cards into my 11" Mac Book Air.  I have an issue with the Text files
    that seem to accompany each and every image that I do not need.  How do I stop Apple Script (which I assume is the culprit in this case)  from interferring with this process.

    Your iWeb Site is stored not on your iDisk, but on a file named Domain.sites in your ~/Home/Library/Application Support/iWeb/ Folder.
    If , for whatever reason, you wipe your HD and/or lose this file (Get a new computer, Re-Install your OS, Stolen Laptop, Crashed HD, Etc.) without backing-up your Domain.sites file then you will have to re-build your iWeb sites from scratch again.
    Of course you can edit your Published HTML files in a different program such as Dreamweaver or even Text Edit. You just can't edit Published HTML files in iWeb. Not at this time at least.
    Use iWebBackup to backup your Domain file to a Blank CD or DVD. Backing up your Domain file to another folder on your computer is not fully backing it up. If your computer gets stolen you still lost the file but if you have your Domain file burned onto a CD you have a backup!
    Download iWebBackup Here
    You can use iWebExtender to automatically consolidate your files into one folder and delete multiple images.
    http://iWebFAQ.com

  • Apple Script to rename single files in folders

    Hey guys, I am trying to write a script to automatically rename a lot of files.  Here is the situtation:
    I have a MainFolder with many SubFolders inside.  Inside each SubFolder is 1 word document.  Is there a way to write a script that automatically renames each of of those word documents to its folder's name.  Example.
    BEFORE:
                      -SubFolder1 - 1.doc
                      -SubFolder2 - 1.doc
    -MainFolder -SubFolder3 - 1.doc
                      -SubFolder3 - 1.doc
    AFTER:
                      -SubFolder1 - SubFolder1.doc
                      -SubFolder2 - SubFolder2.doc
    -MainFolder -SubFolder3 - SubFolder3.doc
                      -SubFolder3 - SubFolder4.doc
    Thanks.

    The following script should do what you are asking for:
    set mainFolder to choose folder
    tell application "Finder"
        repeat with thisFolder in (get folders of mainFolder)
            try
                set name of (file 1 of thisFolder whose name extension is "doc") to (name of thisFolder & ".doc")
            end try
        end repeat
    end tell
    If there's just one file in each subfolder (wich is not exactly the same as “one Word document”), you could remove the “whose name extension is "doc"” filter.

  • Renaming Images from Text File

    Hello,
    I am trying to rename images in a folder to match the names within in a text file. The names in the text file are all unique, so using a rename batch like example-1.jpg, example-2.jpg, etc. won't work. I have matched the structure between both the name and image file, so I need automator to traverse down the text file and add each unique name to the corresponding image.
    If anyone has some help for this it will greatly be appreciated! Thanks

    I wrote you a shell script that will do the job.
    First, put all your images into a folder (if you haven't already done so). Make a copy of the folder for safety's sake (I tested the script and it should work fine, but it's always good to have a backup).
    Now, make sure each new name in the text file is on its own line. Rename the file to "list.txt" and put it in the same folder as the images (better make a copy of the list, too).
    Now, download this file: http://danielrichman.com/tmp/file_rename.sh
    Put it in the same folder as your images.
    Now, open Applications -> Utilities -> Terminal and type the following (without quotes):
    "cd "
    Then open up the Finder window that contains the images. In the title bar of the window, there's a little folder icon. Drag the icon into the Terminal window. (You should see the path copied.)
    Then, in Terminal, press enter.
    Then copy this (and press enter at the end):
    "chmod a+x ./file_rename.sh"
    Then, do this:
    "./file_rename.sh"
    That should be it! Please let me know how it goes.
    Good luck!
    ddr

  • Not able to write image in csv file

    I have tried to write JPEG file in csv but having a critical probem.
    The JPEG in the CSV is coming wrongly. Means whenever I open the created CSV file I can see the image has been moved upside down.
    Can any one please help me how to write a proper image using ClientAnchor?
    Can anyone please provide any sample code
    Edited by: 837718 on Feb 17, 2011 6:25 PM

    Try this
         Workbook workBookObject= new HSSFWorkbook();
         Sheet sheet = wb.createSheet();
         CreationHelper helper = wb.getCreationHelper();
         Drawing drawing = sheet.createDrawingPatriarch();
    ByteArrayOutputStream img_bytes = new ByteArrayOutputStream();
                   int b;
                   while ((b = fis.read()) != -1)
                        img_bytes.write(b);
                   fis.close();
                   helper = workBookObject.getCreationHelper();
                   ClientAnchor anchor = helper.createClientAnchor();
                   int picIndex = workBookObject.addPicture(img_bytes.toByteArray(),Workbook.PICTURE_TYPE_JPEG);
                   anchor.setCol1(col);
         anchor.setRow1(0);
                   anchor.setAnchorType(ClientAnchor.MOVE_DONT_RESIZE);
                   pic = drawing.createPicture(anchor, picIndex);
                   pic.resize();

  • How to use csv file to populate all the items in a form

    Our environment - Forms 6i/IAS 9i on Solaris/8.1.6 database on
    Solaris.
    In the web form I want the user to type in the name of an
    existing csv file(which contains 1 record). Then press a button
    and all the items on the form should be populated with the data
    in the csv file.
    One method is load the data in the csv file into the database
    using sqlloader and then execute a query to populate the form.
    Is there another way - instead of loading the file in the databas
    e? Thanks

    Hi Afroz,
    To be more specific, if the csv file doesn't has header, please refer to this script to add header:
    $csv = Import-Csv d:\haha.csv -Header "UserA","UserXYZ","EmailA"
    Then you can loop this csv file to run the "add-mailboxpermission" cmdlet, I recommend you can test this script before running against production environment, please also note I haven't tested this script:
    $csv = Import-Csv d:\users.csv -Header "UserA","UserXYZ","EmailA"
    foreach($each in $csv){
    write-host "assign fullaccess permission of user $($each.UserXYZ) on mailbox $($each.EmailA)"
    get-mailbox -identity $each.EmailA | add-mailboxpermission -user $each.UserXYZ -accessrights 'fullaccess'
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How to batch rename from a CSV file?

    Hello,
        I have about 1000 photos that need to be renamed with UPC's from a CSV file. Is there a script (or easier way) to import a CSV column and add it to the file extension?
    Example:
    _MG_5200.CR2 would need to read  00726899281640_MG_5200.CR2

    There are a number of csv to ldif options out there. If you want to drop your users into WLS, then formatting into an ldif is the easiest way to bulk load.
    http://tinyurl.com/88mwxb3
    -ryan

  • Create Response groups multiple reponse groups using CSV file

    Hi Champs,
    We have good amount of response groups has to be created, I try to write the script but failed. Can any one help me to create Response groups through script.
    In below script agents should be taken from CSV file.
    Import-Module Lync
    $serviceId="service:"+(Get-CSService | ?{$_.Applications -like "*RGS*"}).ServiceId;
    $ag = New-CsRgsAgentGroup -Name "agent group" -Parent $serviceId;
    $ag.Description = "Contain the agents";
    $ag.ParticipationPolicy = "Formal"
    $ag.AgentAlertTime = "20"
    $ag.AgentsByUri.Add("sip:[email protected]")
    $ag.AgentsByUri.Add("sip:[email protected]")
    $ag.AgentsByUri.Add("sip:[email protected]")
    Set-CsRgsAgentGroup $ag
    Regards
    Vijendhar

    You also need to create queue and workflow. Please check how to create Response Group using Lync Server Management Shell at
    http://blogs.technet.com/b/csps/archive/2010/09/15/rgscreateresponsegroup.aspx.
    Lisa Zheng
    TechNet Community Support

  • After the upgrade to Mozilla 32 using csv files to import data does not work anymore. What should I do?

    Hello,
    After the latest upgrade to Mozilla 32 a previously recorded imacros scirpt in which the data was being imported into mozilla from a csv file keeps erroring out. This same problem occurred with the with the upgrade to Mozilla 30 and was fixed when Mozilla was upgraded to 31. Can you please advise on how to correct the problem so that csv files can be used in conjunction with imacros scripts. I would like to point out that imacros still works without the use of csv files, but when you introduce a csv to the script the imacros does not work.
    Thank you,
    Eugene

    hello eugene, please directly contact the imacros extension developers through the means provided at their [http://forum.iopus.com/viewforum.php?f=11 forum] - they can likely give you more detailed guidance and are the only ones who can fix bugs or make necessary adjustments in the addon for new firefox versions. thank you...

  • Script to import contacts from CSV file into Address Book

    Hi,
    I am wondering if it would be possible to import contacts from a CSV file into a group in Address Book using applescript, and if so, if anyone is aware of a script that does this or something similar.
    I have a CSV file with three columns 'First Name', 'Last Name' and 'Email Address'.  I would like these to correspond with  'First', 'Last' and (Work) 'Email' in Address Book.
    Ideally the script would also check to see if entries already exist for the people being imported, but this is less crucial.
    Thanks in advance for any assistance,
    Nick

    Hi,
    Test this on a very small csv file (four or five contacts) to see if it works for you. It will not de-duplicate. You don't give the name of the group, so you'll need to replace Name of group in the second line with your group name, enclosed in double quotes.
    --begin script
    set the_people to read (choose file with prompt "Choose your CSV file")
    set the_group to "Name of group"
    set old_tids to AppleScript's text item delimiters
    set AppleScript's text item delimiters to ","
    set par_count to (count paragraphs in the_people)
    repeat with x from 1 to par_count
              set next_par to paragraph x of the_people
              set first_name to text item 1 of next_par
              set last_name to text item 2 of next_par
              set e_mail to text item 3 of next_par
              tell application "Address Book"
                        set nu_person to make new person with properties {first name:first_name, last name:last_name}
      make new email at end of emails of nu_person with properties {label:"Work", value:e_mail}
                        add nu_person to group the_group
      save
              end tell
    end repeat
    set AppleScript's text item delimiters to old_tids
    --end script
    Watch out for bad line breaks in the lines beginning "set nu_person..." and "make new email..."

  • Using csv files and automatic activation

    We have setup our hybrid with Office 365, how can I use the csv file to migrate and activate the users at the same time ? I can migrate the users but they are not activate otomatically. Actually we plan to ONLY activate exchange not the other products
    like Lync, Sharepoint..at the moment.

    Hi,
    Do you migrate mailboxes to Exchange Online with a staged migration?
    When you migrate mailboxes to Exchange Online with a staged migration, you can create a CSV file to create a migration batch.
    After a migration batch has finished running, you need to convert the on-premises mailboxes in the migration batch to mail-enabled users by downloading related scripts and run it.
    I'm afraid there is no way to migrate and activate the users at the same time using a single CSv file.
    Here is a related article for your reference.
    http://technet.microsoft.com/en-GB/library/jj874018(v=exchg.150).aspx
    Best regards,
    Belinda Ma
    TechNet Community Support

  • How can i update an existing item in sap using CSV file?

    Hi,
    i am trying to update an existing Item in SAP using a CSV file.
    in the message log i get an error message that the item already exists.
    what should i do in order to update the existing record?
    Thanks, Udi

    Hi..........
    I would sugest you to use Tab delimited file and choose proper option in order to update the itsm master in DTW......
    Regards,
    Rahul

  • Export Address Book using CSV file to Verizon Webmail

    I need to export the contents of my address book using a CSV file format which is compatible with Verizon Webmail.
    Verizon Webmail will not acknowledge any other format other than CSV and reject my attempts to use Mac sys tem formats.
    Help.... Chan

    I need to export the contents of my address book using a CSV file format which is compatible with Verizon Webmail.
    Verizon Webmail will not acknowledge any other format other than CSV and reject my attempts to use Mac sys tem formats.
    Help.... Chan

  • How to create power shell script to upload all termset csv files into the SharePoint2013 local taxonomy ?

    Hi Everyone,
    I want to create a powershell script file
    1) Check a directory and upload all termset csv files into the SharePoint local taxonomy.
    2) Input paramaters - directory that containss termset csv files, Local Termstore to import to,
    3) Prior to updating get a backup of the existing termstore (for rollback/recovery purposes)
    4) Parameters should be passed in via XML file.
    Please let me know how to do it.
    Regards,
    Srinivas

    Hi,
    Please check this link
    http://termsetimporter.codeplex.com/
    Please remember to click 'Mark as Answer' on the answer if it helps you

Maybe you are looking for

  • BD52 Change Document Items - How to copy from one message type to another

    Hi, I have created a new messaget type for idoc MATMAS03, and has to implement change pointers for the new message type. I will use the same fields to trigger the change as is used for message type MATMAS. My problem is that it will be a really tires

  • Where is the iLike side bar on iTunes 9 ???

    Question is in the title, how do I get back my iLike sidebar in iTunes 9 ?? Message was edited by: Jo#1

  • Error during email account validation

    I'm trying to activate my email account, and keep getting the message "An error occurred during email account validation. Please check your information and try again." Any advice?

  • IPad can't sync contacts with iCloud

    I need some help....  I have an iMac running Mtn Lion (10.8.2) and an iPad3 (6.0.1) and I'm trying to sync the two in iCloud.  Contacts are giving me a headache.  I've got the contacts into iCloud so I went to iTunes, clicked on the iPad and went to

  • Adding Text on Pictures

    Hi, is there anyway I can use iPhoto 6 to add text on a picture? I've posted my pictures on my website and I would like to add my name on them to prevent it from being used by somebody else. Thank You in advance.