Automator: Create new folders from .csv file and put images inside.

I have a challenging Automator task to achieve. I need to
1) create a set of folders labeled with the contents in column A of a csv file. (example: column A1 JoeBrown A2 SuzyBrown A3 JimBrown etc..) resulting in
3 folders titled JoeBrown, SuzyBrown, and JimBrown
2) take the image represented by an image number in column B of the same csv file and move that file into the folder that was created (example: A1 JoeBrown gets a folder created by the name JoBrown and column B IMG_1234.jpg is physically moved from within the same folder as the .csv file into the folder created by column A.
Both the csv and img files would be in the same folder. I have the script to create a set of folders from a csv list just can't complete the moving of files based on the contents of column B.
SUMMARY: I have a folder containing several images img_0001, img_0002, img_0003 etc. and a csv file that contains columnA a series of names and column B a series of jpg image numbers. I need to have a script that will create folders labeled whatever name is in column A (see the script below. it works great!) then move the images from column B to the folders generated from column A.
The csv script is:
tell application "Finder"
  set mgFolder to container of mgCSVfile as string
  repeat with x from 1 to count paragraphs of mgList
    set text item delimiters of AppleScript to ","
    set mgThisList to text items of paragraph x of mgList as list
    set text item delimiters of AppleScript to ""
    set mgTopFolder to item 1 of mgThisList
    if (exists folder mgTopFolder of folder mgFolder) is false then
      make new folder at mgFolder with properties {name:mgTopFolder}
    end if
    set mgNewFolder to (folder mgTopFolder of folder mgFolder) as alias
    repeat with i from 2 to count mgThisList
      if item i of mgThisList is not "" then
        set mgSubFolder to item i of mgThisList
        if (exists folder mgSubFolder of folder mgNewFolder) is false then
          make new folder at mgNewFolder with properties {name:mgSubFolder}
        end if
      end if
    end repeat
  end repeat
end tell
Thanks for any help that may come my way.

This should work
(assumes a true "," seperated file with only two items per line, i.e.: Test,Test.jpg):
The Run Shell Script Action is:
cd "${1%/*}"
while read line         
do         
     FolderName=${line%,*}
     ImageName=${line#*,}
     mkdir "$FolderName"
     mv "$ImageName" "$FolderName"
done < "$1"

Similar Messages

  • Read from csv file and plot particular columns

    Hello,
    I`m a new user of Labview and here it comes...my first major problem.
    Maybe this has been discussed before. I’ve made a search to solve my problem first but I couldn`t find anything helpful so I `ve decided to post a new message.
    So here is my problem:
    I`m working in a small semiconductor lab where different types of nitrides are grown using proprietary reactor. The goal is to read the collected csv files from each growth in Labview and plot the acquired data in appropriate graphs.
    I have a bunch of csv files and I have to make a Labview program to read them.
    The first part of my project I`ve decided to be displaying the csv file (growth log file) under labview (which I think works fine).
    The second one is to be able to plot particular columns from the recipe in graphs in Labview (that one actually gives me a lot of trouble):
    1. Timestamp vs Temperature /columns B and D/
    2. Timestamp vs Gas flow /columns L to S/
    3. Timestamp vs Pressure /columns E,K,T,U,V/
    I`ve got one more problem. How can I convert the Timestamp shown in csv file to human readable date in labview? This actually is a big problem, because the timestamp is my x axis and I want to know at what time a particular process took place and I also want to be able to see the converted timestamp when displaying csv file at first. I`ve read a lot about time stamping in excel and timestamp in labview but I`m still confused how to convert it in my case.
    I don`t have problems displaying csv file under Labview. My problems are with the timestamp and the graphs.
    Sorry for my awful English.  I hope you can understand my problems since English is not my mother language. 
    Please find the attached files.
    If you have any ideas or suggestions I`ll be more than happy to discuss them.
    Thank you in advance.
    Have a nice day! 
    Attachments:
    growth log.csv ‏298 KB
    Read from growth log.vi ‏33 KB

    Hello again,
    I`m having problems with converting the first column in the attached above file Growth Log.csv.
    I have a code converting xl timestamp to time and using Index Array traying to grab a particular column out of it but the attached file is written in strings so I guess I have to redo it in array but I don`t know how.Would you help me with this one?
    Attachments:
    Xl Timestamp to Time.vi ‏21 KB

  • Read from xls file and put it in a table

    Hi,
    I've an xls file while is having 8 cells with some thousands of rows. i've to write a procedure to read that file and put it in a table(each cell as each column). pls help me how to proceed. i'm using oracle 9i
    Regards
    Abdul Muthalef

    as Gasparotto said, copy the csv file to the database server.
    create a directory object on the database.
    create directory dir_temp as 'e:\mydir'
    grant read, write on directory dir_Temp to <user>
    and then map this csv file to the external table using the below syntax.
    CREATE TABLE tab_hierarchy
    node_id          NUMBER,
    parent_id     NUMBER,
    description      VARCHAR2(255)
    ORGANIZATIOn EXTERNAL
         TYPE ORACLE_LOADER
         DEFAULT DIRECTORY dir_temp
         ACCESS PARAMETERS
         records delimited by newline
         fields terminated by ','
         (node_id,parent_id,description)
         LOCATION ('tree.csv')
    PARALLEL
    REJECT LIMIT UNLIMITED;in the above code, replace the filename under the LOCATION with your csv file name.
    now you should be just able to do select on this table and insert to the other main tbale.

  • How to create new Sheet in Excel file and write into it

    Hi to all, my requirement is this:
    I have an excel file (.xls) with multiple sheets (three sheets for precision: sheet1, sheet2 and sheet3).
    I must create in the same excel file new sheet, say sheet4, read data from sheet1, sheet2 and sheet3 and write them into sheet4.
    How to realize this in SSIS?
    Expecially, Is it possible to realize this in SSIS?
    thanks in advance.

    You need to create the sheet with the required metadata. There's no use creating blank sheet.
    Also metadata has to be fixed using a sample sheet prior to start of the package for setting the mapping. You may create a excel template for this purpose to just set the mapping at design time.
    At runtime pass actual excel sheet path for ExcelFilePath property of the source to point to correct file.
    Also the create table statement should include the same metadata info (columns)
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
    Hi, well it works fine! I have used a sample sheet prior to start of the package for setting the mapping.
    Next at run time  pass actual excel sheet path for ExcelFilePath property of the source to point to correct file.
    However I have set also ValidateExternalMetadata properties of the Excel Destination to false and DelayValidation properties of the package to true.
    Now my problem is the following:
    I stored the three sheets name (sheet1, sheet2, sheet3) in the Object type user variable through a script task and the foreach loop loops through the three sheets stored in the variable.
    Now, I want that at each iteration the CURRENT VALUE of the Object type user variable is mapped into another user variable wich in turn is given in input to the Excel Source.
    Resuming:
    -) I have to copy the content of three sheets (sheet1, sheet2, sheet3) of excel file into another new sheet,   sheet4.
    -) I stored the three sheets name (sheet1, sheet2, sheet3) in the Object type user variable.
    -) With a  foreach loop container I loops the three sheets stored in the Object type user variable.
    -) Within a foreach loop container I have a Data Flow Task that transfer data from source sheet (sheet1, sheet2, sheet3) into destination sheet, sheet4.
    -) PROBLEM: how to change dinamically at each iteration of the foreach loop the name of source sheet? In the destination excel Task the sheet is always the same at each iteration, sheet4. But in the source excel task the name of sheet musts change at each
    iteration. In particular at the first iteration the name of the source sheet must be "sheet1$", at the second iteration "sheet2$", in the last iteration "sheet3$".
    How to change sheet name dinamically at each iteration?
    thanks.

  • How to generate graphs from csv file and show on remote clients?

    Hi,
    I have set of csv files. Each file has 104 parameters. From these parameters different graphs have to be generated and displayed to remote clients thru tomcat.
    Can anyone tell me how to do that?
    cheers,
    its reeju

    it's very easy to load the CSV into java objects. Once you have done that why not use the Java2D API to draw your graphs and then use the Sun JPG encoder tools to write out a jpg stream back to the browser (you will need to set the content type for jpg).

  • Read from csv file and graph at certain interval

    Hi,
    I've been trying all day to modify a labView program so it reads in data from my csv file to graph temperatures from 4 ovens. The temperatures are logged in the csv file at 3s intervals and i wish to display them on 4 graphs. I've written a vi (or modified one i should say) to take in a temperature value from a numeric control. Im just having extreme difficulty with the reading part.
     If someone can help me it would be greatly appreciated.
    Best regards,
    Dawn
    Attachments:
    Oven temps.csv ‏2 KB
    Oven_level_meas.vi ‏58 KB

    Hi there,
    I have a similar problem here.  I see your point that you should read the file at once but I don't seem to be able to manage it.  Shouldn't you use some kind of
    a buffer to achieve this?  Let me tell you what I am trying to do:  I have a csv file with several columns that I want to display in several waveform charts.  Each column is a wavechart.  I should be able to change the speed at which the data is displayed.  I am able to do this because I change the wait until (ms) in the for loop.  However the application is too slow.  I think because I open the csv file in the for loop and display it while I am reading it.  I have tried to put it outside the for loop but this doesn't work.  I think I need some kind of a buffer in which the data is stored after reading it.  And then this buffer should be used in the for loop.  I have looked at the producer-consumer structure but I dont fully understand it as I am not that experienced with labview.  Any help or changes to my VI would be appreciated.  I have attached the VI and the file with meaningless data I am using for testing.
    Thanks
    Attachments:
    read_data_file_dynamically.vi ‏39 KB
    test.CSV ‏332 KB

  • It is possible to get data from Excel file and put them in BusinessObject Entreprise?

    Hi everybody,
    How i can get the information (data table) from a excel file?
    I just want to open a file excel in BusinessObject Entreprise XI. It is possible?
    Thanks

    What is BI launch pad?
    BI platform includes BI launch pad, a web application that acts as a window to business information
    about your company. In BI launch pad, you can perform the following tasks:
    • Access Crystal reports, Web Intelligence documents, and other objects and organize them to suit
    your needs
    • View information in a web browser, export it to other business applications (such as Microsoft Excel
    and SAP StreamWork), and save it to a specified location
    9 2012-03-14
    Getting Started
    • Use analytic tools to explore the business information in detail
    The features of BI launch pad vary by content type, and various applications are available in BI launch
    pad, if you have the appropriate licenses. For information about the features in your BI platform
    deployment, contact your system administrator.
    plz download this file and u can get you answer
    http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCMQFjAA&url=http%3A%2F%2Fhelp.sap.…

  • Delay / Lag when creating new folders or copying files... Y2P

    If I make a new fold on the desktop or copy / paste files to the desktop (or within a folder) there is a delay. Sometimes it takes 5-10 seconds for the newly created folder to appear.
    Has anybody noticed this?

    Additional info I forgot to include...   The user imported the crashing project from a Powerpoint file. I have read that this feature in Captivate causes many issues, so I even copied all of the slides to a blank presentation on the working computer and saved that out. Still crashes that way on the problematic computer.

  • How can i cut the audio from 1 file and put it on another?

    I have these2 files of the same movie, 1 is amazing quality but theres no audio. the other is crummy quality but has perfect audio. How can I cut the audio from the good audio version and paste it onto the good video file?
    btw i have quicktime pro is that changes anything

    Open the movie and press "Command J". This will bring up the properties window. Click on the Audio Track or Video Track and the "Extract/Delete" buttons will light up. Click "Delete" and it'll delete the currently selected track, click "Extract" and it will extract the selected track into a new movie. Just use Delete on the correct track and you're halfway there.
    Then, select the movie that is just an Audio Track now, do "Command A" then "Command C" to copy the audio track. Go to the movie that's just a video track, move the insertion point to the beginning of the video then do "Option Command V" to add the Audio Track to the Video Track side by side.

  • Creating new folders on my Nokia Lumia 620

    1) On my Windows 7 pc I can easily create new folders at any time and then copy any webpage to any folder (via going into the Favorites tab). How can I do this with my Nokia Lumia 620?  
    2) If this is not possible, is it not possible to do so on a Windows 8 pc either?
    Thanks for any info.
    Moderator's Note: We have changed the title into a subject-related title. This is to keep the forum organized and let other forum users easily see and respond to this post.

    Sorry, for "going into the Favorites" please read "clicking on the File menu and then the Save as...option".

  • How to configure sync rules involving a CSV file and portal self service

    Hello,
     I need to configure some FIM sync rules for the following scenario:
     User account details are entered from a HR CSV file and exported to AD  Users have the ability to modify their own AD attributes in the
    FIM portal (there is not a requirement for them to view their  HR CSV data in the portal). The FIM portal modifications will be exported to AD as expected.  
    My setup is as follows:
    CSV file - name, last name, employee ID, address.
    CSV MA - has direct attribute flows configured in the MA between the data source and MV Portal self service attributes –      
    users can edit mobile, display name and photo
    I've also set the CSV MA as precedent for the attributes
    FIM MA – attribute flows defined for MV to Data Source as usual (i.e. firstname to firstname, accountname to accountname, etc).
    AD MA – no attribute flows defined as inbound and outbound sync rules have been configured in the portal using the Set\MPR\Triple.
    I’m thinking of using the following run profiles:
    CSV MA – full import and delta sync (imports HR data)
    FIM MA –  export and delta import (imports portal changes)
    FIM MA – delta sync (syncs any portal changes)
    AD MA – export and delta import
    If my understanding is correct this should sync HR data from CSV to AD, as well as user attribute self service updates from the portal to AD.
    If I wanted to just do a HR CSV sync could I get away with just steps 1 & 4 ? (presumably not as my rules are in the FIM portal?)
    If I wanted to do just a portal sync, could I get away steps 2-4?
    Any advice on how to improve my setup is much appreciated - cheers
    IT Support/Everything

    The truth is that your design should be done in the way that it doesn't matter which profiles in which order you will execute. At the end, if you will run all import, synch and export profiles on each data source you should get same result. This is beauty
    of synch engine here.
    Your steps from 1-4 will synch data to your data sources and at the end will give you expected result. But not because of the order you are executing them but because of correct attribute flows. If flows from CSV file and from FIM portal might be done for
    the same attributes you need to think also about attribute precedence.   
    Tomek Onyszko, memberOf Predica FIM Team (http://www.predica.pl), IdAM knowledge provider @ http://blog.predica.pl

  • Create folders from CSV

    I have a CSV file that contains 8 columns.
    Each column starts with a Business unit name, there are a couple or rows below each columns with Employee Names.
    I need to create in a folder a new folder for each Business Unit, and within each Business Unit folder, i need to create subfolders for each employee name.

    Take a look at this script:
    https://gallery.technet.microsoft.com/scriptcenter/472300a7-9706-44df-a2a1-a85c4e6ebd13
    You can run the next script 8 times for each business and change the variable:
                $Business - the Business unit name on each column
    and only one time_
                $Path        -  path to create the folders
               $FileCSV   - import Business and Employees data from this file
    Pay attention to CmdLet Import-Csv and its Delimiter if is ',' or ';'
    $Business="B1"
    $Path = "D:\TEMP\"+$Business
    $FileCSV='d:\temp\teste2.csv'
    md $Path
    Set-Location $Path 
    $LinesCSV = Import-Csv $FileCSV -Delimiter ','
    ForEach ($Line in $LinesCSV) { 
        New-item $Line.$Business  -type directory

  • How to create new folders on iCloud Drive from iOS or with document picker?

    Recently I wanted to share several files from my iWorks suite with my colleagues. I do not want them to edit these files, instead I made templates in Numbers for easier management of hours worked. Everyone could download their copy and keep a track of their hours themselves. The problem is, not everyone has an Apple product.
    Unfortunately, iOS does not support native browsing of iCloud Drive (except the document picker, which, to me, isn't helpful at all), the only way I know of - to create a new folder - is to open iCloud.com in Safari, request the desktop site and make a new folder from there.
    Is there another way of creating new folders, preferably an official app from Apple or from within an iWorks app or the document picker that I do not know of? Or is this actually a missing feature?
    Also, if Apple could make an app similar to Microsoft OneDrive, that would be great.

    Yes, there is a way. Here is the workaround. You can add notes folders directly with your iPad or iPhone.
    http://keeplifesimple.weebly.com/1/post/2013/11/add-folders-to-native-notes-app- on-ios.html
    Enjoy! Please pass it on, leave a comment on the page, or "like us" on Facebook if you find this information helpful.

  • How to invoke and receive from csv file

    I have an employee.csv file which contains empid and empname deatils,
    I want to fetch corresponding empid by giving input as empname from the employee.csv file and write empid into DB
    I had created an read file for employee.csv, but for the receive activity only one variable is created
    how to give input(empname) to the file and to get the empid from that file.
    Please help me from this issue

    In receive activity output file will contain the information of the entire list of empid and emp names. Wrive java code in java embedded activity to fetch the details of your desired output then use assign activity to continue your flow.
    try {                
    oracle.xml.parser.v2.XMLText text =(oracle.xml.parser.v2.XMLText)getVariableData("OnMessage_composeAndDistributeMQ_InputVariable","payload","/client:composeAndDistributeRequest/client:ControlInformation/client:SystemID/text()");
    String SystemID = text.getNodeValue();
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat justDateTime = new SimpleDateFormat("yyyyMMddHHmmss");
    String DateTimeString = justDateTime.format(cal.getTime());
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
    Date now = new Date();
    addAuditTrailEntry("Now = " + df.format(now));
    long timeInMilli = now.getTime();
    addAuditTrailEntry("Date() - Time in milliseconds: " + now.getTime());
    String DRI = SystemID + "003" + DateTimeString + timeInMilli + "0000001";
    setVariableData("Invoke_RequestMQ", "body", "/ns2:DocumentRequests/ns2:DocumentRequest/ns2:MailItemInfo/ns2:DocumentRequestId", new String(DRI));
    catch (Exception e) {                
    e.printStackTrace();
    }

  • Need to take a value from the csv file and query in a OAF page.

    Hello,
    I have a requirement to take the list of employee numbers in a csv file and display its corresponding job on the page.
    I have created a item 'MessageFileupload' where the user will upload the csv file containing the employee number and a Button 'Display Jobs' which will display the corresponding jobs on the page.
    Any idea how to take the values from the csv file and query it?
    Regards,
    den123.

    Hi ,
    Check
    http://oraclearea51.com/contribute/post-a-blog-article/csv-file-upload-for-oa-framework.html
    http://www.roseindia.net/jsp/upload-insert-csv.shtml
    Below code works from above blogs.
    package xx.oracle.apps.pa.Lab.webui;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    // import java.io.*;
    import oracle.apps.fnd.common.VersionInfo;
    import oracle.apps.fnd.framework.OAApplicationModule;
    import oracle.apps.fnd.framework.OAException;
    import oracle.apps.fnd.framework.server.OAViewObjectImpl;
    import oracle.apps.fnd.framework.webui.OAControllerImpl;
    import oracle.apps.fnd.framework.webui.OAPageContext;
    import oracle.apps.fnd.framework.webui.beans.OAWebBean;
    import oracle.jbo.domain.BlobDomain;
    import oracle.cabo.ui.data.DataObject;
    import oracle.jbo.Row;
    * Controller for ...
    public class deptCsvUploadCO extends OAControllerImpl
      public static final String RCS_ID="$Header$";
      public static final boolean RCS_ID_RECORDED =
            VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
       * Layout and page setup logic for a region.
       * @param pageContext the current OA page context
       * @param webBean the web bean corresponding to the region
      public void processRequest(OAPageContext pageContext, OAWebBean webBean)
        super.processRequest(pageContext, webBean);
       * Procedure to handle form submissions for form elements in
       * a region.
       * @param pageContext the current OA page context
       * @param webBean the web bean corresponding to the region
      public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
        super.processFormRequest(pageContext, webBean);
        // Code Addition Started for CSV upload
        OAApplicationModule am = (OAApplicationModule) pageContext.getApplicationModule(webBean);
        OAViewObjectImpl vo = (OAViewObjectImpl) am.findViewObject("deptCsvVO1");
          //if ("GoBtn".equals(pageContext.getParameter(EVENT_PARAM)))
           if (pageContext.getParameter("GoBtn") != null)
          System.out.println("Button Pressed");
              DataObject fileUploadData =(DataObject)pageContext.getNamedDataObject("FileUploadItem");
              String fileName = null;
              String contentType = null;
              Long fileSize = null;
              Integer fileType = new Integer(6);
              BlobDomain uploadedByteStream = null;
              BufferedReader in = null;
                      try
                      fileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
                      contentType =(String)fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
                      uploadedByteStream = (BlobDomain)fileUploadData.selectValue(null, fileName);
                      in = new BufferedReader(new InputStreamReader(uploadedByteStream.getBinaryStream()));
                      fileSize = new Long(uploadedByteStream.getLength());
                      System.out.println("fileSize"+fileSize);
                      catch(NullPointerException ex)
                      throw new OAException("Please Select a File to Upload", OAException.ERROR);
                      try{ 
                      //Open the CSV file for reading 
                      String lineReader=""; 
                      long t =0;
                      String[] linetext; 
                      while (((lineReader = in.readLine()) !=null) )
                      //Split the deliminated data and
                      if (lineReader.trim().length()>0)
                      System.out.println("lineReader"+lineReader.length());
                      linetext = lineReader.split(","); 
                      t++;
                      //Print the current line being
                      if (!vo.isPreparedForExecution())
                              vo.setMaxFetchSize(0);
                              vo.executeQuery();
                        System.out.println("Trimmed "+  linetext[1].replace("\"", ""));
                      Row row = vo.createRow();
                      row.setAttribute("Deptno", linetext[0].trim());
                      row.setAttribute("Dname",linetext[1].trim().replace("\"", ""));
                      row.setAttribute("Loc",linetext[2].trim().replace("\"", ""));
                      //row.setAttribute("Column4", linetext[3].trim());
                      vo.last();
                      vo.next();
                      vo.insertRow(row);
                      catch (IOException e)
                            throw new OAException(e.getMessage(),OAException.ERROR);
              //else if (pageContext.getParameter("Upload") != null)
              am.getTransaction().commit();
              throw new OAException("Uploaded SuccessFully",OAException.CONFIRMATION);     
    }Thanks,
    Jit

Maybe you are looking for