Number of files in a directory

Hello,
How can I count how many files are in a directory?

Now it looks like this:
- - - - - - - - - - - - - - - - - - - - PHP code - - - - - -
<?php
$someValue = 6;
echo "&someValue=".$someValue."&";
?>
- - - - - - - - - - - - - - - - - - - - AS code - - - - - - -
var MyLV:LoadVars = new LoadVars();
MyLV.onLoad = function() {
trace(MyLV.someValue);
MyLV.load("
http://www.sages.hu/galeria/kepgaleria.php");
It is working, so the Flash traces "6", but how can I do that
the PHP does not print it out?

Similar Messages

  • Checking Number of Files in a Directory

    Hi
    How can I read the filenames in a directory and determine the number of files in this directory.I need to put all the filenames in a drop down list box on a JSP.
    Please Advise

    FilenameFilter filter = new FilenameFilter() {
      public boolean accept(File dir, String name) {
        File file = new File(dir, name);
        return file.isFile(); // true if file, false if directory
    File dir = new File("c:\\temp"); // the directory we want to list the files from
    File[] files = dir.listFiles(filter);
    // or String[] files = dir.list(filter); I haven't checked the code, so there might be some typos..

  • "Get Info" Reports an Incorrect Number of Files in a Directory

    I have a 17" MacBook Pro with OS X, 10.6.4. I've been relying upon Finder's "Get Info" to determine how many files a directory contains, and I never noticed any problems when using it. However, this afternoon I saw an anomaly with the actual number of files in a directory and what "Get Info" reported.
    I had previously created a new directory and moved 23 files to it. This morning I added three (3) more files to the directory, for a total of 26 files. This afternoon I added another five (5) files for a final total of 31 files in the directory. While Finder's "Get Info" showed that the directory had been updated this afternoon, it would not update the number of files it contains -- it still showed 26 files and the old total file size. I had to log out and log back in again for it to show me the correct file size and number of files.
    Is this normal behavior or was it a glitch in Finder? That is, can I rely upon Finder to tell me the correct number of files in a folder -- or not?
    Is there a way to force Finder to refresh itself? I looked around, but I did not see anything obvious, which is why I tried the logout/login method of refreshing it.
    Thanks,
    Bev in TX

    Welcome to Apple Discussions.
    This is a known issue in Finder. No fix I know of but a decent refresh here.
    -mj

  • Powershell Script to Copy an Unknown number of Files in a Directory

    I need to be able to copy an unknown number of files in a folder to an FTP site.  I have the FTP components figured out and working, but am running into a problem when there is only 1 file for upload.  The folder is a queue that users manually
    copy files to, so i do not have control of how many files may be pending.  And the file names are always different.
    My script performs the following steps.
    1. Get a list of files in the directory with the a attribute.  (this prevents subfolders from being processed)
    2. Loop thru the list, copying each file.
    Here is my problem.
    no files. nothing happens. normal and expected
    2 or more files. all files upload correctly.  EXPECTED
    Filename returned from variable = "True".  File does not exist and upload fails.  ERROR
    This is what the script looks like. (There are several Write-Output statements for debugging purposes.
    $ftpUploadPath = "$ftpServer/claims/"
    $localUploadPath = "$localDir\claims\"
    $localSentPath = "$localUploadPath`Sent\"
    $listFile = "$localDir\uplist.txt"
    Write-Output "Uploading Claim files to $ftpUploadPath ..."
    #1 get list of claim files to upload
    $list = Get-ChildItem -Name $localUploadPath -Attributes a   
    Write-Output $list
    Write-Output " "
    #2 loop thru list and upload files
    if($list.Length -ne 0){
        #Write-Output "  Getting files from list"
        # download each file in the list
        foreach ($file in $list -cne "") {
            Write-Output $file
        } # end foreach file
    } #end if($list.Length)
    else {
        Write-Output "  No files for upload"
    } #end else($list.Length)
    Thanks in advance,
    Greg

    You are writing way too many lines for such a simple task. Try this:
    Get-ChildItem -Name $localUploadPath -Attributes a |
    ForEach-Object{
    Write-Host $_ -fore green
    $_
    \_(ツ)_/

  • Finding the number of files in a directory

    hi,
    im trying to return the count of all the files that are available in a specific directory. does anyone know how or what method would spport this?
    Im new to Java and swing please help!
    Thanks

    Hi,
    all you need is provided by the File class. With this class you can work with "physical" files.
    Try this:
    String path = "your directory";
    File file = new File(path);
    String[] fileArray;
    try{
    fileArray = file.list();
    //you need fileArray.length
    System.out.println("Number of files found in "+path+ fileArray.length);
    }catch(SecurityException se){
    //handle exception
    }

  • Number of files in unix directory

    Hi All,
    anyone can help me, how can I get the number of files in specific unix directory and number of files in each
    sub-directory inside that directory?
    Thank You

    Hi,
    Use the following program which will list the files on a unix system.
    Put/modify the logic for getting the file count. (play around)
    REPORT ZUNIXFILES MESSAGE-ID Z1
                      NO STANDARD PAGE HEADING
                      LINE-COUNT 65
                      LINE-SIZE  132.
    Global Variables.                                                   *
    DATA: BEGIN OF TABL OCCURS 0,
              LINE(2000),
          END OF TABL.
    DATA: PARCOM_LOC LIKE RS37A-LINE.
    DATA: SIZE(10) TYPE C,
          LINE     LIKE TABL-LINE,
          SUM(16)  TYPE C.
    DATA: FILE LIKE RS37A-LINE.
    DATA: PATH(255) TYPE C.
    Parameters.                                                       *
    SELECTION-SCREEN SKIP 2.
    PARAMETERS: PARCOM LIKE RS37A-LINE.
    *AT SELECTION-SCREEN.
    AT SELECTION-SCREEN.
      CONDENSE: PARCOM NO-GAPS.
    *TOP-OF-PAGE.
    TOP-OF-PAGE.
      PERFORM WRITE_PAGE_HEADING.
    *INITIALIZATION.
    INITIALIZATION.
      PARCOM = '/usr/sap/*'.               "Only default value
    *START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM MAKE_LOC.
      PERFORM COLLECT_DATA.
      PERFORM FILE_LIST.
    *AT LINE-SELECTION.
    AT LINE-SELECTION.
      CLEAR FILE.
      FILE = SY-LISEL+55.
      REPLACE '|' WITH SPACE INTO FILE.
      IF SY-LISEL+1(1) = 'd'.
         PATH = FILE.
         PATH+200 = '/*'.
         CONDENSE PATH NO-GAPS.
         SUBMIT ZUNIXFILES
           WITH PARCOM = PATH
           AND RETURN.
      ENDIF.
      SUBMIT ZBROWSEFILE            "Call the browse program
         WITH PARCOM = FILE
         AND RETURN.
    FORM MAKE_LOC.                                                      *
    FORM MAKE_LOC.
      CLEAR: PARCOM_LOC.
      PARCOM_LOC(7)    = 'ls -ld '.
      PARCOM_LOC+7(45) = PARCOM.
    ENDFORM.
    FORM COLLECT_DATA.                                                  *
    FORM COLLECT_DATA.
      REFRESH TABL.
      CALL 'SYSTEM' ID 'COMMAND' FIELD PARCOM_LOC
                    ID 'TAB'     FIELD TABL-SYS.
    ENDFORM.
    FORM FILE_LIST.                                                   *
    FORM FILE_LIST.
      FORMAT RESET.
      CLEAR SUM.
      LOOP AT TABL.
        CLEAR LINE.
        LINE = TABL-LINE.
        WRITE /2 LINE.
        PERFORM VERTICAL_LINES.
        SUM = SUM + SIZE.
      ENDLOOP.
      WRITE:/1(132) SY-ULINE.
    ENDFORM.
    FORM WRITE_PAGE_HEADING.                                          *
    FORM WRITE_PAGE_HEADING.
      WRITE:/1(132) SY-ULINE.
      PERFORM VERTICAL_LINES.
      FORMAT INTENSIFIED.
      WRITE: /2(131) SPACE COLOR 1.
      WRITE:  2    SY-DATUM COLOR 1.
      WRITE: 35 'File Manager' COLOR 1.
      PERFORM VERTICAL_LINES.
      WRITE:/1(132) SY-ULINE.
      PERFORM VERTICAL_LINES.
      FORMAT INTENSIFIED.
      WRITE: /2(131) SPACE  COLOR 3.
      PERFORM VERTICAL_LINES.
      FORMAT RESET.
      WRITE:/1(132) SY-ULINE.
    ENDFORM.
    FORM VERTICAL_LINES.                                              *
    FORM VERTICAL_LINES.
      PERFORM WRITE_VLINE USING ' '  1.
      PERFORM WRITE_VLINE USING ' '  132.
    ENDFORM.
    WRITE_VLINE.                                                      *
    FORM WRITE_VLINE USING MODE POS.
      IF MODE NE 'T'.
        FORMAT INTENSIFIED.
      ENDIF.
      POSITION POS.
      WRITE: SY-VLINE.
      IF MODE NE 'T'.
        FORMAT RESET.
      ENDIF.
    ENDFORM.

  • How to find the number of files in an oracle directory through a storedproc

    hi
    i have an oracle directory or a directory in an ftp server
    is there any way.......through which..
    i can know the number of files in the directory ...?
    and whats the metadatacolumn that will indicate the name of the file?
    and is it possible to loop through each of the entries within oracle
    regards
    raj

    ops$tkyte@8i> GRANT JAVAUSERPRIV to ops$tkyte
      2  /
    Grant succeeded.
    That grant must be given to the owner of the procedure..  Allows them to read
    directories.
    ops$tkyte@8i> create global temporary table DIR_LIST
      2  ( filename varchar2(255) )
      3  on commit delete rows
      4  /
    Table created.
    ops$tkyte@8i> create or replace
      2     and compile java source named "DirList"
      3  as
      4  import java.io.*;
      5  import java.sql.*;
      6 
      7  public class DirList
      8  {
      9  public static void getList(String directory)
    10                     throws SQLException
    11  {
    12      File path = new File( directory );
    13      String[] list = path.list();
    14      String element;
    15 
    16      for(int i = 0; i < list.length; i++)
    17      {
    18          element = list;
    19 #sql { INSERT INTO DIR_LIST (FILENAME)
    20 VALUES (:element) };
    21 }
    22 }
    23
    24 }
    25 /
    Java created.
    ops$tkyte@8i>
    ops$tkyte@8i> create or replace
    2 procedure get_dir_list( p_directory in varchar2 )
    3 as language java
    4 name 'DirList.getList( java.lang.String )';
    5 /
    Procedure created.
    ops$tkyte@8i>
    ops$tkyte@8i> exec get_dir_list( '/tmp' );
    PL/SQL procedure successfully completed.
    ops$tkyte@8i> select * from dir_list where rownum < 5;
    FILENAME
    data.dat
    .rpc_door
    .pcmcia
    ps_data
    http://asktom.oracle.com/pls/asktom/f?p=100:11:4403621974400865::::P11_QUESTION_ID:439619916584
    Edited by: Salim Chelabi on 2009-04-21 10:37

  • FTP: how to get total number of files in directory

    Hello Folks,
    I prefer to use FTP from the command line but cannot figure out how--after having connected to a remote directory via ftp--to list the total number of files in that directory.
    In Unix, I would do this:
    % ls | wc -l
    But hopefully there is also some way in FTP to do the same--but darned if I know how! I do see that FTP clients such as Transmit have this listing, but maybe that's a feature of the software and not ftp.
    Thanks in advance for any suggestions/tips.
    Doug

    I've done a lot of ftp scripts 10 years ago, mostly because I could not guarantee my scripted telnet would be available everywhere. The best answer today though is listed throughout this thread and that is to use the ssh family of commands that include ssh for secure remote shell, scp for secure remote copy and sftp which is the ftp interface to scp.
    My point is neither telnet or ftp are considered safe or secure anymore because listening to communications is popular, it is referenced in most "wizard" magazines, and usernames and passwords are not encrypted.
    Set up your environment first with ssh-keygen. Version 2 is more secure than version 1 if both are still offered. Then use "ssh user@hostname ls | wc -l" to get your number of files. It is simple execution with one command and returns a status.
    If you are really looking for a solution using what you are familar with and want to ignore advice concerning security, here is a sample batch script (untested). You can change the filenames, usernames, and hostnames as desired.
    rm dir.out 2> /dev/null
    echo "user sampleuser samplepw" > script.ftp
    echo "dir sampledirectory dir.out" >> script.ftp
    echo "quit" >> script.ftp
    ftp -n sample.hostname < script.ftp
    if [ ! -r dir.out ] # file not created
    then
    echo login failed
    elif [ ! -s dir.out ] # file created but empty
    then
    echo directory is empty
    else
    nf=`wc -l dir.out | cut -f1`
    echo "There are $nf files in the directory"
    fi

  • How can i find total no of files in a directory ..using fileconnection

    how can i find total no of files in a directory.
    currently iam using
    Enumeration enum = fileconn.list(); and by iterating iam getting count.
    but the application is getting stuckup when the number of files in the directory is large.
    Is there any alternative. please help.
    thanks in advance.

    HI,
    this is a simple example with a cursor over user_tables view:
    set serveroutput on
    DECLARE
       CURSOR c_test IS
          SELECT table_name FROM user_tables;
       type t_reg is table of varchar2(30);
       l_reg t_reg;
    BEGIN
       OPEN c_test;
       fetch c_test bulk collect into l_reg;
       dbms_output.put_line(c_test%ROWCOUNT);
    END;
    /Output:
    SQL>
    SQL> set serveroutput on
    SQL> DECLARE
      2     CURSOR c_test IS
      3        SELECT table_name FROM user_tables;
      4     type t_reg is table of varchar2(30);
      5     l_reg t_reg;
      6  BEGIN
      7     OPEN c_test;
      8 
      9     fetch c_test bulk collect into l_reg;
    10 
    11     dbms_output.put_line(c_test%ROWCOUNT);
    12  END;
    13  /
    42
    PL/SQL procedure successfully completed
    SQL> Regards,
    Edited by: Walter Fernández on Nov 29, 2008 8:59 AM - Adding output...

  • Count files in Directory and the number of files in each sub directory

    Hello,
    I trying write a method which will start at a root of a file and count all the files in that directory. Then count all the files in each sub directory.
    import java.io.File;
    import java.io.FilenameFilter;
    import java.io.IOException;
    public class RunScan {
         * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              File file = new File("/home/robert/count");
              File[] files = file.listFiles();
              traverse(files);
              printfiles();
         private static int totalNumFiles = 0;
         private static int totalNumDir = 0;
         private static int filePerDir = 0;
         private static int subDir = 0;
         private static void traverse(File[] files) {
    for(int i = 0; i < files.length; i++) {
    if(files.isDirectory()) {
         totalNumDir++;
         printDir(files[i].toString());
         traverse(files[i].listFiles());
    totalNumFiles++;
    filePerDir++;
         private static void printfiles(){
              System.out.println("total files "+ (totalNumFiles));
         System.out.println("totls sub dir "+ totalNumDir);
         private static void printDir(String dirName){
              System.out.println("Total Files in "+dirName+" "+filePerDir);
              filePerDir = 0;

    Hint: Google "visitor pattern." This gives clues how to build a re-usable solution that can you use for future traversals that do things other than just file counts. Here's a teaser of an simple interface:
    public interface TreeVisitor {
    * Processes a single file or directory. <em>Tip:</em> If you want to track the number of
    * items processed, this function is the best place to update a counter.
    * Implementors of this method should not throw checked exceptions.
    * @param item The file or directory process.
    * @param depth Number of levels below top of traversal tree (0 = top of tree).
    public void visit(File item, int depth);
    }

  • Count the number of lines in  each file in a directory

    Hello,
    I would like to count the number of lines for each file in my directory and subdirectories.
    I wonder how can I count the lines of the specified files?
    Here is the program which is listed the files in the specified directory:
                        String path = "C:/User/Studies/Pracices/src/Pract1";
           String files;
           File folder = new File(path);
           File[] listOfFiles = folder.listFiles();
           for (int i = 0; i < listOfFiles.length; i++)
            if (listOfFiles.isFile())
         files = listOfFiles[i].getName();
         System.out.println(files);

    Ok so one more question.
    Actually my path is pointing to one Directory and like here I can just read from one file that the name of the file should be specified in the path is it possible to help me in that part?
    File f = new File("C:/User/Studies/Practices/src/Pract1/");
    FileReader fr = new FileReader(f);
          BufferedReader br = new BufferedReader(fr);
          String str = br.readLine();
              LineNumberReader ln = new LineNumberReader(br);
              int count = 0;
              while (ln.readLine()!=null)
                  count++;
              System.out.println("no. of lines in the file = " + count);

  • Huge number of files in the profile directory with at sign in the name

    Hi,
    I noticed that my wife's Firefox v35 running on Windows 8.1 32bit has a huge number of files like:
    cert8@2014-03-25T19;02;18.db
    content-prefs@2014-01-30T21;28;58.sqlite
    cookies@2014-01-08T18;12;29.sqlite
    healthreport@2015-01-20T06;44;46.sqlite
    permissions@2015-01-19T10;26;30.sqlite
    webappsstore@2015-01-20T06;44;48.sqlite
    Some files are quite new.
    The original files get somehow backed up, but I cannot figure out how. My own PC does not contain such files.
    Thanks

    I've called the big guys to help you. Good luck.
    BTW, did you post this from the wife's computer?
    Type '''about:support''' in the address bar and press '''Enter.'''
    Under the main banner, press the button; '''Copy Text To Clipboard.'''.
    Then in the reply box at the bottom of this page,
    do a right click in the box and select '''Paste.'''
    This will show us your system details.
    '''No Personal Information Is Collected.'''

  • How do i delete Older files from the directory before create a new file?

    Hi,
    How do i delete older files in a particular directory,
    the senorio is count the number of .txt files in a directory and delete the older files if file count is more than 10. (if i add 11th file the very first file has to be deleted)
    i have written the code to count the files and delete , but it is deleting all the files instead of older file
    public class ExtensionFilter implements FilenameFilter {
      private String extension;
      public ExtensionFilter( String extension ) {
        this.extension = extension;            
      public boolean accept(File dir, String name) {
        return (name.endsWith(extension));
    public class FileUtils{
      public static void main(String args[]) throws Exception {
        FileUtils.deleteFiles("c:/countfile/", ".txt");
      public static void deleteFiles( String directory, String extension ) {
        ExtensionFilter filter = new ExtensionFilter(extension);
        File dir = new File(directory);
        String[] list = dir.list(filter);
        File file;
        if (list.length == 0) return;
        for (int i = 0; i < list.length; i++) {
          //file = new File(directory + list);
    file = new File(directory, list[i]);
    if ((list[i]).length()>=10)
         System.out.print(file + " deleted : " + file.delete());
    Thanks,
    Jamin Rosina                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    What your code is doing now, is deleting all filenames that are longer than 10 characters.
    Your problem lies in the line:
    if ((list).length()>=10)

  • How do I delete a file from a directory

    I want to delete the file I have finished processing in the c:\upload directory but the f.delete() command is not working. Am I using this command correctly?
    The f.delete() is after I copy the file to an archive directory.
    Program:
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.sql.*;
    public class ReadSource {
    public static void main(String[] args) throws Exception {
         StringTokenizer st1;
              String val1, val3, val4, val5, val9, val10, val11, val12, val13, val14, val16;
              String val2, val6, val7, val8, val15, val17, val18, val19, val20;
              int cnt;
              File f = new File("C://upload" );
              FileWriter outFile = new FileWriter("C://RIFIS/log/logfile.txt", true);
              String filetext = "Starting RIFIS Upload";
              java.util.Date d = new java.util.Date();
              SimpleDateFormat form = new SimpleDateFormat("dd/MMM/yyyy hh:mm:ss");
              String dateString = form.format(d);
         try {
              Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@xxxxx.xxxx.xxx:1521:xx","xxxxxx","xxxx");
                        Statement st = conn.createStatement();
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write(filetext+" - "+dateString);
                        if (f.isDirectory())
                        { String [] s = f.list();
                        for (int i=0; i<s.length; i++)
                        { outFile.write(System.getProperty("line.separator"));
                             outFile.write("Found file - "+f+"/"+s);
              FileReader file = new FileReader(f+"/"+s[i]);
                                  File inputFile = new File(f+"/"+s[i]);
                                  File outputFile = new File("C://RIFIS/archive/"+s[i]);
                        BufferedReader buff = new BufferedReader(file);
                        boolean eof = false;
                        String val0="";
                        ResultSet rec = st.executeQuery("SELECT landings_hold_batch_seq.nextval FROM dual");
                        while(rec.next())
                        { val0 = rec.getString(1); }
                                  cnt=0;
                        while (!eof)
                        { String line = buff.readLine();
                             if (line == null)
                             { eof = true; }
                             else
                             { //System.out.println(line);
                                       cnt = cnt+1;
                                  st1 = new StringTokenizer(line,",");
                                       val1 = st1.nextToken();
                                       val2 = st1.nextToken();
                                       val3 = st1.nextToken();
                                       val4 = st1.nextToken();
                                       val5 = st1.nextToken();
                                       val6 = st1.nextToken();
                                       val7 = st1.nextToken();
                                       val8 = st1.nextToken();
                                       val9 = st1.nextToken();
                                       val10 = st1.nextToken();
                                       val11 = st1.nextToken();
                                       val12 = st1.nextToken();
                                       val13 = st1.nextToken();
                                       val14 = st1.nextToken();
                                       val15 = st1.nextToken();
                                       val16 = st1.nextToken();
                                       val17 = st1.nextToken();
                                            val18 = st1.nextToken();
                                            val19 = st1.nextToken();
                                            val20 = st1.nextToken();
                                       /*System.out.println("Token 0: " + val0);
                                  System.out.println("Token 1: " + val1);
                                  System.out.println("Token 2: " + val2);
                                       System.out.println("Token 3: " + val3);
                                       System.out.println("Token 4: " + val4);
                                       System.out.println("Token 5: " + val5);
                                       System.out.println("Token 6: " + val6);
                                       System.out.println("Token 7: " + val7);
                                       System.out.println("Token 8: " + val8);
                                       System.out.println("Token 9: " + val9);
                                       System.out.println("Token 10: " + val10);
                                       System.out.println("Token 11: " + val11);
                                       System.out.println("Token 12: " + val12);
                                       System.out.println("Token 13: " + val13);
                                       System.out.println("Token 14: " + val14);
                                       System.out.println("Token 15: " + val15);
                                       System.out.println("Token 16: " + val16);
                                       System.out.println("Token 17: " + val17);
                                            System.out.println("Token 18: " + val18);
                                            System.out.println("Token 19: " + val19);
                                            System.out.println("Token 20: " + val20);*/
                                       st.executeUpdate("INSERT INTO LANDINGS_HOLD (lh_id, lh_batch, supplier_dr_id, supplier_unique_id, supplier_dealer_id, supplier_cf_id, supplier_vessel_id, unload_year, unload_month, unload_day, state_code, county_code, port_code, itis_code, market, grade, reported_quantity, unit_measure, dollars, lh_loaddt, lh_loadlive, purch_year, purch_month, purch_day)" +
                        "VALUES (0,'"+val0+"','"+val1+"',"+val2+",'"+val3+"','"+val4+"','"+val5+"',"+val6+","+val7+","+val8+",'"+val9+"','"+val10+"','"+val11+"','"+val12+"','"+val13+"','"+val14+"',"+val15+",'"+val16+"',"+val17+",SYSDATE,NULL,"+val18+","+val19+","+val20+")");
                             FileReader in = new FileReader(inputFile);
                             FileWriter out = new FileWriter(outputFile);
    int c;
                             while ((c = in.read()) != -1)
                             { out.write((char)c); }
                             in.close();
                             out.close();
                             outFile.write(System.getProperty("line.separator"));
                             outFile.write("Number of records inserted - "+cnt);
                             outFile.write(System.getProperty("line.separator"));
                             outFile.write("Copied upload file to archive directory");
                             f.delete(); // delete the upload file
                             outFile.write(System.getProperty("line.separator"));
                             outFile.write(f+"/"+s[i]+" - Has been removed from upload directory");
                             buff.close();
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("Upload Complete...NO ERRORS");
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("*************************************************************");
                        outFile.write(System.getProperty("line.separator"));
                        //outFile.flush();
              //outFile.close();
                        conn.close();
                        else
                        { outFile.write("No files to process"); }
              catch(Exception e)
                   { outFile.write(System.getProperty("line.separator"));
                   outFile.write("ALERT....ALERT....ALERT");
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("Error Occurred in ReadSource.java - RIFIS Upload");
                        outFile.write(System.getProperty("line.separator"));
                   outFile.write("My Error: " + e);
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("*************************************************************");
                   outFile.flush();
              outFile.close();

    Gave it a try but file c:\upload\DS121002.csv did not go away. Here is the location of my delete command:
    st.executeUpdate("INSERT INTO LANDINGS_HOLD (lh_id, lh_batch, supplier_dr_id, supplier_unique_id, supplier_dealer_id, supplier_cf_id, supplier_vessel_id, unload_year, unload_month, unload_day, state_code, county_code, port_code, itis_code, market, grade, reported_quantity, unit_measure, dollars, lh_loaddt, lh_loadlive, purch_year, purch_month, purch_day)" +
                        "VALUES (0,'"+val0+"','"+val1+"',"+val2+",'"+val3+"','"+val4+"','"+val5+"',"+val6+","+val7+","+val8+",'"+val9+"','"+val10+"','"+val11+"','"+val12+"','"+val13+"','"+val14+"',"+val15+",'"+val16+"',"+val17+",SYSDATE,NULL,"+val18+","+val19+","+val20+")");
                             FileReader in = new FileReader(inputFile);
                             FileWriter out = new FileWriter(outputFile);
    int c;
                             while ((c = in.read()) != -1)
                             { out.write((char)c); }
                             in.close();
                             out.close();
                             inputFile.delete();
                             outFile.write(System.getProperty("line.separator"));
    ............

  • How to open and read many files from a directory and store contents in 2D array?

    I want to make a VI that opens and reads the data from various files contained in a directory (200 files each with 2 columns) and store these in a single 2D array. For file number 1 I want to store the data from both columns in the 2D array, but for files 2 to 200 I only want to store the second column of each file. Can someone please help?

    Hi Nadav,
    Thanks for your help. I have followed your instructions but i cannot get it to work. I used the LIST DIRECTORY to list the files in the directory - that works. However, how do I read each of the 200 files using READ FROM SPREADSHEET FILE without me having to manually select each of the 200 files? So, if I use LIST DIRECTORY to list all 200 files in an array, how do I get each of these to open and store the data in a 2D array? Here is what I have done (File called read_files.VI) Could you please help me? Thank you very much in advance.
    Attachments:
    read_files.vi ‏18 KB

Maybe you are looking for