Reading multiples files from a folder and processing

Hello everyone,
Im working on a project to analyst and process Acoustic Emission Signals. My problem is that I have a folder that containts several files .txt. Every file contains 16 waveforms (16 channels) that I need to process with an equation to detect the arrival times of the waves.
I have been working in this way : Running the labview code that open the file that I select .. then the processing happens on every wave and I click stop to select the file where I want to save the solutions. The solutions is only a vector of the 16 arrival times detected. Then I have to stop the code (by clicking Abort Execution) and repeat the process ... Run the code and bla bla bla .. and save on the same solution file that I used before.
The ideal situation is to read the files whitout stoping the execution of the code .. For example clicking a buttom to pass to the next file and saving all the solutions to the same file. That is beacause sometimes Im going to have more than a 100 files and this will give me a hard time if a forget in which file I was working. The idea is to make an automatic process.
Please .. I have been trying to find a solution to this while Im working in other part of the code. If someone could suggest me a solution it would be great.
Thanks.

Hello everyone,
Well Im sorry if I didn't post my .vi ... I was working on it ... and I found a solution (whit some help that I found on the forums) but Im not happy at all ... because I still have to give the last part of the file name.
For example at the beginning I have to input the file name without the final number of the event ...
C:\Users\Irish\Desktop\Hydraulic Fracturing\E1_evento
then I finish adding the file number that I want to process on the folder
C:\Users\Irish\Desktop\Hydraulic Fracturing\E1_evento2.txt or 9.text or ... just the number ...
This is the case when I want to process every file specifying the file .. but what could you suggest me to do process all the data file by file ?
I attached the part of the code that Im using for this specific problem ...
Im using Labview 8.5
Thanks ...
Message Edited by Alvaro_Ortiz on 08-26-2009 03:14 PM
Attachments:
MultReadFiles.vi ‏58 KB

Similar Messages

  • How use PHP to read image files from a folder and display them in Flex 3 tilelist.

    Hello. I need help on displaying images from a folder dynamically using PHP and display it on FLEX 3 TileList. Im currently able to read the image files from the folder but i don't know how to display them in the TileList. This is my current code
    PHP :
    PHP Code:
    <?php
    //Open images directory
    $imglist = '';
    $dir = dir("C:\Documents and Settings\april09mpsip\My Documents\Flex Builder 3\PHPTEST\src\Assets\images");
    //List files in images directory
    while (($file = $dir->read()) !== false)
    if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
    echo "filename: " . $file . "\n";
    $dir->close();
    ?>
    FLEX 3 :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="pic.send();">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    import mx.rpc.events.FaultEvent;
    import mx.events.ItemClickEvent;
    import mx.rpc.events.ResultEvent;
    public var image:Object;
    private function resultHandler(event:ResultEvent):void
    image = (event.result);
    ta1.text = String(event.result);
    private function faultHandler(event:FaultEvent):void
    ta1.text = "Fault Response from HTTPService call:\n ";
    ]]>
    </mx:Script>
    <mx:TileList x="31" y="22" initialize="init();" dataProvider = "{image}" width="630" height="149"/>
    <mx:String id="phpPicture">http://localhost/php/Picture.php</mx:String>
    <mx:HTTPService id="pic" url="{phpPicture}" method="POST"
    result="{resultHandler(event)}" fault="{faultHandler(event)}"/>
    <mx:TextArea x="136" y="325" width="182" height="221" id="ta1" editable="false"/>
    <mx:Label x="136" y="297" text="List of files in the folder" width="182" height="20" fontWeight="bold" fontSize="13"/>
    </mx:Application>
    Thanks. Need help as soon as possbile. URGENT.

    i have made some changes, in the php part too, and following is the resulting code( i tried it, and found that it works.):
    PHP Code:
    <?php
    echo '<?xml version="1.0" encoding="utf-8"?>';
    ?>
    <root>
    <images>
    <?php
    //Open images directory
    $dir = dir("images");
    //List files in images directory
    while (($file = $dir->read()) !== false)
    if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
    echo "<image>" . $file . "</image>"; // i expect you to use the relative path in $dir, not C:\..........
    //$dir->close();
    ?>
    </images>
    </root>
    Flex Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    creationComplete="callPHP();">
    <mx:Script>
    <![CDATA[
    import mx.rpc.http.HTTPService;
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    import mx.rpc.events.FaultEvent;
    import mx.events.ItemClickEvent;
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable]
    private var arr:ArrayCollection = new ArrayCollection();
    private function callPHP():void
    var hs:HTTPService = new HTTPService();
    hs.url = 'Picture.php';
    hs.addEventListener( ResultEvent.RESULT, resultHandler );
    hs.addEventListener( FaultEvent.FAULT, faultHandler )
    hs.send();
    private function resultHandler( event:ResultEvent ):void
    arr = event.result.root.images.image as ArrayCollection;
    private function faultHandler( event:FaultEvent ):void
    Alert.show( "Fault Response from HTTPService call:\n " );
    ]]>
    </mx:Script>
    <mx:TileList id="tilelist"
    dataProvider="{arr}">
    <mx:itemRenderer>
    <mx:Component>
    <mx:Image source="images/{data}" />
    </mx:Component>
    </mx:itemRenderer>
    </mx:TileList>
    </mx:Application>

  • I want to make a schedular which read xml files from a folder ,import in Indesign template then export as a pdf....

    i want to make a schedular probably in Coldfusion or using javascript ,  which read xml files from a folder ,import in Indesign template then export as a pdf....

    I don't think you understand: I want to open Dreamweaver and build a brand new site, then when I am done I want to host the dreamweaver site on the Business Catalyst platform. I dont want to use anything in BC to build the site, I just want to use the hosting platform. I do not want to import a BC site into dreamweaver or anything like that. I just want to use BC the same way I would use godaddy, or uhost or any other hosting provider. Based on your response you said that "of course its possible to build a BC site in Dreamweaver" I dont want to build a BC site, I want to build a Dreamweaver site and host it on the BC platform. Like I said before it doesnt seem like this is possible. As of now we can only build a new site in MUSE and integrate it into BC without using a BC template. Can you understand what I am saying. I DONT WANT TO USE A BC TEMPLATE, I WANT NOTHING TO DO WITH BC WHILE I AM BUILDING THE SITE WITH DREAMWEAVER, JUST LIKE MUSE DOES.

  • How to read the file from a folder.

    Hi All,
    How to read the file from a folder or directory from the non sap server / remote server.
    Regards
    Sathis

    open dataset filename for input in text mode
                         encoding default.
    filename is character type variable with the destination filename.
    Edited by: Jino Augustine on Apr 19, 2010 1:31 PM

  • What are the commands available to read a file from application server and

    What are the commands available to read a file from application server and store the file into an internal table?

    Hi,
    To read a file from an Application Server to an Object there is a command in ABAP called <b>READ DATASET</b>. After that file is transported to that object you have to do a loop and put that data in an Internal Table.
    This statement exports data from the file specified in dset into the data object dobj. For dobj, variables with elementary data types and flat structures can be specified. In Unicode programs, dobj must be character-type if the file was opened as a text file.
    For dset, a character-type data object is expected - that is, an object that contains the platform-specific name of the file. The content is read from the file starting from the current file pointer. After the data transfer, the file pointer is positioned after the section that was read. Using the MAXIMUM LENGTH addition, the number of characters or bytes to be read from the file can be limited. Using ACTUAL LENGTH, the number of characters or bytes actually used can be determined.
    In a Unicode program, the file must be opened with an arbitrary access type; otherwise, an exception that cannot be handled will be triggered.
    If the file has not yet been opened in anon-Unicode program, it will be implicitly opened as a binary file for read access using the statement
    OPEN DATASET dset FOR INPUT IN BINARY MODE.
    . If a non-existing file is accessed, an exception that can be handled can be triggered.
    Influence of Access Type
    Files can be read independently of the access type. Whether data can be read or not depends solely on the position of the file pointer. If the latter is at the end of the file or after the file, no data can be read and sy-subrc will be set to 4.
    Influence of the Storage Type
    The import function will take place irrespective of the storage type in which the file was opened with the statement OPEN DATASET.
    If the file was opened as a text file or as a legacy text file, the data is normally read from the current position of the file pointer to the next end-of-line marking, and the file pointer is positioned after the end-of-line marking. If the data object dobj is too short for the number of read characters, the superfluous characters and bytes are cut off. If it is longer, it will be filled with blanks to the right.
    If the file was opened as a binary file or as a legacy-binary file, as much data is read that fits into the data object dobj. If the data object dobj is longer than the number of exported characters, it is filled with hexadecimal 0 on the right.
    If the specified storage type makes conversion necessary, this is executed before the assignment to the data object dobj. Afterwards, the read data is placed, byte by byte, into the data object.
    System Fields
    sy-subrc Meaning
    0 Data was read without reaching end of file.
    4 Data was read and the end of the file was reached or there was an attempt to read after the end of the file.
    Thanks,
    Samantak.
    <b>Rewards points for useful answers.</b>

  • I want read PDF file from SAP directory and create a spool request or print

    Hi all,
    I want read PDF file from SAP directory and create a spool request or print the pdf through SAP. Can any body  help me in this.
    Also please write to me if its possible to open PDF from SAP directory to adobe pdf reader.
    Thanks in advance,
    Sunny

    Hi Sunny,
    Check these links.
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    http://www.erpgenie.com/sap/abap/pdf_creation.htm
    http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
    http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Reading a file from a folder.

    Hi everyone,
    I am trying to modify my first java program.
    The method below is used to read a file that is hard coded in the below method. What I would like it to do is to pick up files that are stored in a folder. The reason for this is that the file names will never be the same.
    I am unsure how to do this and would appreciate some help from you.
    Thanks in advance.
    public void fileBreakdown()
              try
                   FileReader file = new FileReader("files/myTextFile.txt");
                   BufferedReader buffer = new BufferedReader(file);
                   String textline = null;
                   ArrayList arr =  new ArrayList();
                   while ((textline = buffer.readLine()) != null)
                        boolean syswarnEndFound = false;
                        if((textline.substring(45, 52)).equals("SYSWARN"))
                             System.out.println(textline.substring(45, 52));
                             arr.add(textline);
                             while ((textline = buffer.readLine()) != null && !syswarnEndFound)
                                  if(textline.indexOf("}") == -1)
                                       //System.out.println("not found : " + textline);
                                       buffer.mark(1000);
                                       arr.add(textline);
                                  else
                                       //System.out.println("found");
                                       syswarnEndFound = true;
                                       buffer.reset();
                                       OutputFileTypes.processSYSWARN(arr);
                        else if((textline.substring(45, 51)).equals("SYSMSG"))
                             System.out.println("Stopped, program ends");
                             System.out.println(textline.substring(45, 51));
                             arr.add(textline);
                             while ((textline = buffer.readLine()) != null && !syswarnEndFound)
                                  if(textline.indexOf("}") == -1)
                                       buffer.mark(1000);
                                       arr.add(textline);
                                  else
                                       syswarnEndFound = true;
                                       buffer.reset();
                                       OutputFileTypes.processSYSMSG(arr);
                        else
                             String[] messageArr = textline.split(" ");
                             Processing.whichFileType(getSubject(messageArr),getMessage(messageArr),getPublishedDate(messageArr));
                             getPublishedDate(messageArr);
                   buffer.close();
              catch( IOException e) {System.out.println(e);}
         }

    I could not compile your code. But if you wanted to get all .txt files from a folder then you could do something like this
    class EndsWith implements FilenameFilter {
         String ext;
         public EndsWith(String ext) {
              this.ext = "." + ext;
         public boolean accept(File dir, String name) {
              return name.endsWith(ext);
         public static void main(String args[]) {
              String srcDir="C:/temp/";
              try {
                   File srcFiles = new File(srcDir);
                  FilenameFilter filteredFiles = new EndsWith("txt");
                  String sourceDir[]=srcFiles.list(filteredFiles);
                  for(int i=0;i<sourceDir.length;i++)
                       String fileName = srcDir+sourceDir;
              System.out.println(fileName);
              FileReader file = new FileReader(fileName);
              //..your code here
              }catch(IOException ioe) {
                   ioe.printStackTrace();
    NOTE: I haven't tested this code. You can give a try.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • FTP Adapter to read multiple files from a directory. Not through polling.

    Dear Friends,
    I would like to know is it possible to configure the FTP adapter in Oracle BPEL 10.1.3.4 to read multiple files (different names, same structure) from a given directory. I do not want the BPEL to do a polling. Instead when I submit the BPEL process it should read all files from the directory.
    I was looking at the option of Synchronous read but I am not able to specify wild card in the file name field. I do not know the file names at the time of reading.
    Thanks for your help!

    Hi,
    While you read the file, you can configure an adapter property in 'Receive'. This will store the filename, this filename can be used for sync read as the input parameter.
    1. Create a message type variable called 'fileheader'. This should be of type Inboundheader_msg (whatever relevant Receive activity).
    2. This variable will contain three parts - filename, FTPhost, FTPPort
    3. Copy this fileheader to 'Syncheader'.
    4. syncheader can be passed as an adapter proerty during sync read of the file.
    During Receive and Invoke, you need to navigate to 'Adapter' tab to choose the created message type variable.
    Let me know if you have further questions.
    regards,
    Rev

  • How to read .mdb file from shared folder

    Hi All,
    In one of my local computer I have a shared folder and within the folder I have a .mdb file. Now I am trying to read that file from MII. I have tried with Get_File_List action block. I am providing the following information to Get_File_List
    Folder :
    <Computer Name>\<Shared Folder Name>
    Mask: .mdb
    But in return of Get_File_List, I am not getting any file related information. It is only providing like below
    <Rowsets>
    <Rowset>
    <Columns>
    <Column Description="Name" MaxRange="0" MinRange="0" Name="Name" SQLDataType="1" SourceColumn="Name"/>
    <Column Description="Date" MaxRange="0" MinRange="0" Name="Date" SQLDataType="93" SourceColumn="Date"/>
    <Column Description="Size" MaxRange="100" MinRange="0" Name="Size" SQLDataType="4" SourceColumn="Size"/>
    <Column Description="LastWriteDate" MaxRange="0" MinRange="0" Name="LastWriteDate" SQLDataType="93" SourceColumn="LastWriteDate"/>
    <Column Description="ReadOnly" MaxRange="1" MinRange="0" Name="ReadOnly" SQLDataType="4" SourceColumn="ReadOnly"/>
    <Column Description="FullPath" MaxRange="0" MinRange="0" Name="FullPath" SQLDataType="1" SourceColumn="FullPath"/>
    </Columns>
    </Rowset>
    </Rowsets>
    Can anybody suggest me how to achieve it.
    Thanks in advance
    Chandan

    Hi Chandan,
    Specify the mask as *.mdb and try.
    Thanks,
    Dipankar

  • Reading XML file from application server and  put into internal table-4.6C

    Dear All,
    Is there any way of reading XML file from application server to SAP? I am using 4.6C. Function module SCMS_STRING_TO_XSTRING function module is not available. Please suggest.
    Thanks and regards,
    Atanu

    Hi Atanu!
    Simply use the XSLT transformation 'ID'.
    FIELD-SYMBOLS <ls_result> TYPE ANY.
    CREATE DATA lref_data TYPE (your_structure).
    ASSIGN lref_data->* TO <ls_result>.
    CALL TRANSFORMATION id
                        SOURCE XML xmlstr
                        RESULT result = <ls_result>.
    "xmlstr" contains your XML file. Just read it into it via standard I/O operations. "<ls_result>" will contain your DDIC formatted content.
    Best regards
    Torsten

  • To read multiple files in sample folder

    How to read multiple files in a same folder?.
    can you give me some guidance?.

    Additionally,
    1. Use methods of the File class to create an array
    of the file names
    2. Stop reading when at the end of the array.That assumes you want all the files in the directory.
    If not, just pass in an array containing the names of the desired files.

  • Read all Files from a Folder on Server

    Hi,
    Can anyone help me in finding if there's any way to read all files in a folder on the server?Any Function module or anything.
    Thanks

    On App server?  Try this sample program.
    report zrich_0001 .
    data: begin of itab occurs 0,
          rec(1000) type c,
          end of itab.
    data: wa(1000) type c.
    data: p_file type localfile.
    data: ifile type table of  salfldir with header line.
    parameters: p_path type salfile-longname
                        default '/usr/sap/TST/DVEBMGS01/data/'.
    call function 'RZL_READ_DIR_LOCAL'
         exporting
              name           = p_path
         tables
              file_tbl       = ifile
         exceptions
              argument_error = 1
              not_found      = 2
              others         = 3.
    loop at ifile.
      format hotspot on.
      write:/ ifile-name.
      hide ifile-name.
      format hotspot off.
    endloop.
    at line-selection.
      concatenate p_path ifile-name into p_file.
      clear itab.  refresh itab.
      open dataset p_file for input in text mode.
      if sy-subrc = 0.
        do.
          read dataset p_file into wa.
          if sy-subrc <> 0.
            exit.
          endif.
          itab-rec = wa.
          append itab.
        enddo.
      endif.
      close dataset p_file.
      loop at itab.
        write:/ itab.
      endloop.
    Regards,
    Rich Heilman

  • Possible to process multiple files from one folder?

    Hi All,
    I have a scenario where four files with different structures will generarted at a folder and these four files need to pick up and process them to find dublicates and merge them... Is it possible? How BODS will identify these four files as they have different strucutres?? Please suggest.
    Thanks
    RAJEEV

    Hi Rajeev,
    Only if the structures are the same then you can use wildcards in the filename.  Do your files have a header record ? If yes, then it's a really quick and easy job to create four file formats since BODS will generate most of the field names and datatypes using the header récord and sample data, once it locates the file and you specify to skip the header record.
    If you really wanted to have only one file format then you would need to define it with a single very long varchar field and then do the parsing of the single long string manually in a Query for each file, using the filename to identify which file structure it is.  Way more work and not an elegant solution.

  • Extract text file from a folder and read the content

    Hi
    I have "n" no.of text files saved in a folder with automatically generated naming convention which include DD/MM/YYYY and also some measurement output value.
    Eg: 1) Die_1_DUT_outputvalue_DD_MM_YYYY.txt
        2) Die_1_DUT_outputvalue_DD_MM_YYYY_ABC.txt
    In the above files part of the 2nd file naming convention same as the first file (i.e. Die_1_DUT and DD_MM_YYYY) whereas outputvalue is different and an additional string named ABC is appended.
    Now I want to search the 2nd file based on matching the naming pattern with the 1st file (note: the outputvalue in the file name is different for both files) and so far followed this method
    1) Use a list folder with *.txt pattern to search all the text files and the output is a 1D array
    2) then use array to cluster and then flatten to XML function to have all the text file names as a string element (not 1D array)
    3) then pass the output of the 2nd step to the sting match pattern and use a regular expression to get the required file name
    4) send the output of the 3rd step to search 1D array to get the index and then get the file name and later use read text file to read the content of the text file
    And I am stuck at the 3rd step while sending an input as the regular expression to match the pattern as the outputvalue in the namming convention of the above two files is different is there any way I can actually extract the filename/file?
    Any suggestions?
    Attachments:
    1.png ‏11 KB

    Some bits in your code are unnecessary, a leaner implementation here:
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • Script to take every 5th file from a folder and copy it to another folder

    How can I tell applescript to take every 5th file of a folder of say 2000 files and copy them to another location? I want to copy the 5th, 10, 15th, 20th files and so on of 2000 files so I will have only 400 files.
    I guess I want to make a list of all the files and then coerce that to the first and then increments of five but how do I do that?
    Thanks.
    Pedro

    Hi Pedro,
    The following script should do what you are asking for:
    *set theSourceFolder to choose folder with prompt "Select the source folder."*
    *set theTargetFolder to choose folder with prompt "Select the target folder."*
    *tell application "Finder"*
    *set theFiles to files of theSourceFolder*
    *repeat with k from 5 to (count theFiles) by 5*
    *move item k of theFiles to folder theTargetFolder*
    *end repeat*
    *end tell*
    Message was edited by: Pierre L.

Maybe you are looking for

  • How do i reduce width of text in received emails to print within 8 1/2" paper

    The width of text in received emails is too wide to print within normal margins of 8 1/2 inch paper, so some of the text at the end off each line does not appear when the email is printed.

  • ERROR: "info.plist does not validate against DTD"

    Hi! I got this error if anyone has it solved Please HELP. I am trying to package a WRT widget using Nokia WRT extension for Adobe Dreamweaver. This is the place for info on the extension: http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/Runtimes/

  • IMovie HD 6 hang-up

    iMovie HD 6 (part of the iLife DVD software) does not work. It hangs up when attempting to work with titles. I have reloaded off the original DVD, dumped preferences, run disk utility. I am now deleting files to create more space on the hard drive fo

  • Can anyone help me with a little display problem in IE7 please?....

    I have just uploaded a new site which has been created using Dreamweaver CS4 for Windows.  There is no problem viewing the site in IE 8, or in Firefox. The site is basically a gallery of images.  For some of the main images I've used little magnifyin

  • J2EE  tutorial and derby

    Hello, I am trying to use J2EE tutorial to learn about the technology. I am having trouble starting the Derby database. When I start Derby , I get the following message logged into db.log file Server is ready to accept connections on port 1527. Could