I don't find the mistake :(

i simply don't find the mistake in that code. it's supposed to browse through a folder you specify and then print out all the files, folders (+ the files in there etc.) into a text file (txt or doc). the output in the eclipse console is correct, but the output to the file is not. if i want to write it to a file (txt or doc) it only browses/writes the top level files and folders. contents of subfolders are not witten into the file? so apparently the recursion doesn't work when i write into a file. but why is that?! below my code...
void browseFolder(String s){
          File destination = new File(s);
          String entries[] = destination.list();
          int i=0;
          try{
               File textfile = new File(s+"/file.doc");
               FileWriter writefile = new FileWriter(textfile);
               BufferedWriter textbuffer = new BufferedWriter(writefile);
               if (destination.isDirectory()){     
                    while (i<entries.length){
                         File destinationUnterfile = new File(s+"/"+entries);
                         if (destinationUnterfile.isDirectory()){
                              //to file
                              textbuffer.write(s+"/"+entries[i]);
                              textbuffer.newLine();
                              textbuffer.write("--------------------------------------");
                              textbuffer.newLine();
                              textbuffer.newLine();
                              //to console
                              System.out.println(" ");
                              System.out.println(" ");
                              System.out.println(s+"/"+entries[i]);
                              System.out.println("--------------------------------------");
                              browseFolder(s+"/"+entries[i]);
                         }else{
                              //to file
                              textbuffer.write("- "+entries[i]);
                              textbuffer.newLine();
                              textbuffer.newLine();
                              //to console
                              System.out.println("- "+entries[i]);
                         }//end if/else
                         i++;
                    }//end while
                    textbuffer.close();
               }else{
                    System.out.println("Please specify a folder to browse.");
               }//end if/else
          }//end try
          catch (IOException e){
               System.out.println("Error -- " + e.toString());
          }//end catch
     }//end browseFolder

hm, does it work if i insert a timestamp into the filename? if tried it like that, but it still doesn't work!
void browseFolder(String s){
          File destination = new File(s);
          String entries[] = destination.list();
          int i=0;
          try{
               Date dt = new Date();
               File textfile = new File(s+"\\file"+dt.getTime()+".doc");
               System.out.println(s+"\\file"+dt.getTime()+".doc");
               FileWriter writefile = new FileWriter(textfile);
               BufferedWriter textbuffer = new BufferedWriter(writefile);
               if (destination.isDirectory()){     
                    while (i<entries.length){
                         //File destinationUnterfile = s+entries;
                         File destinationUnterfile = new File(s+"\\"+entries[i]);
                         if (destinationUnterfile.isDirectory()){
                              //to file
                              textbuffer.write(s+"\\"+entries[i]);
                              textbuffer.newLine();
                              textbuffer.write("--------------------------------------");
                              textbuffer.newLine();
                              textbuffer.newLine();
                              //to console
                              System.out.println(" ");
                              System.out.println(" ");
                              System.out.println(s+"\\"+entries[i]);
                              System.out.println("--------------------------------------");
                              System.out.println(s+"\\"+entries[i]);
                              browseFolder(s+"\\"+entries[i]);
                         }else{
                              //to file
                              textbuffer.write("- "+entries[i]);
                              textbuffer.newLine();
                              textbuffer.newLine();
                              //to console
                              System.out.println("- "+entries[i]);
                         }//end if/else
                         i++;
                    }//end while
                    textbuffer.close();
               }else{
                    System.out.println("Please specify a folder to browse.");
               }//end if/else
          }//end try
          catch (IOException e){
               System.out.println("Error -- " + e.toString());
          }//end catch
     }//end browseFolder

Similar Messages

  • Hi , i want to change my secret question? I don't find the reset bottom?

    Hi , i want to change my secret question? I don't find the reset bottom?

    If you aren't getting the reset link on the Password & Security section of your account on http://appleid.apple.com then that means that you don't have a rescue email address on your account (an alternate email address is different), and you won't be able to add one until you can answer your questions - you will have to contact Support in your country to get the questions reset.
    Contacting Apple about account security : Contact Apple for help with Apple ID account security
    If your country isn't on that page then try this form and explain and see what they reply with : https://ssl.apple.com/emea/support/itunes/contact.html
    When they've been reset you can add a rescue email address one for potential future use : Manage your Apple ID primary, rescue, alternate, and notification email addresses

  • I'm using a trial version but i don't find the spiral tool

    I'm using a trial version but i don't find the spiral tool

    You can do that with any tool button that has a little black arrow in the lower right corner.

  • I don't find the correct download

    I have the creative suite design premium 5.5 education edition. I copy my mac in a new one and some programs don't work. I need to reinstall but I don't find the correct product to download from the website. My activation code fails in every download. I hope someone has some light for me. Thank you.

    If the download did not work for you then that might be your problem.  The download link is legitimate, so it might mean you need to adjust things at your end for the download to work.   Make sure you have cookies enabled and clear your cache.  If it continues to fail try using a different browser.  If you are using the wrong serial number that might be the reason.
    You can also download the trial version of the software thru the page linked below and then use your current serial number to activate it.
    Be sure to follow the steps outlined in the Note: Very Important Instructions section on the download pages at this site and have cookies enabled in your browser or else the download will not work properly.
    CS5.5: http://prodesigntools.com/adobe-cs5-5-direct-download-links.html

  • ORA-03113, I don't find the issue

    Hi all,
    I'm desperate
    I'm trying to create a new database,
    I used the "Database setting wizard" and I got an error : "ORA-03113"
    Each time I try, It occurs while the "Creation and starting an Oracle instance" is running.
    I searched on the web, I didn't find the solution.
    My computer :
    2G ram
    2Ghtz
    Win XP sp3 fr
    oracle 10g
    40Go free
    network loopbak installed
    AVG
    Windows Firewall deactivated
    I run my session with Administrator rights
    PLEASE, someone can help me? Do you know the issue or exactly the problem?
    Jimmy
    This is the content of the alter_test3.log (test3 is my database's name)
    Dump file c:\oracle\product\10.2.0/admin/essai1/bdump\alert_essai1.log
    Sat Oct 11 19:34:18 2008
    ORACLE V10.2.0.1.0 - Production vsnsta=0
    vsnsql=14 vsnxtr=3
    Windows XP Version V5.1 Service Pack 3
    CPU : 1 - type 586, 1 Physical Cores
    Process Affinity : 0x00000000
    Memory (Avail/Total): Ph:1197M/1982M, Ph+PgF:1824M/2501M, VA:1941M/2047M
    Sat Oct 11 19:34:18 2008
    Starting ORACLE instance (normal)
    LICENSE_MAX_SESSION = 0
    LICENSE_SESSIONS_WARNING = 0
    Shared memory segment for instance monitoring created
    Picked latch-free SCN scheme 2
    Using LOG_ARCHIVE_DEST_10 parameter default value as USE_DB_RECOVERY_FILE_DEST
    Autotune of undo retention is turned on.
    IMODE=BR
    ILAT =18
    LICENSE_MAX_USERS = 0
    SYS auditing is disabled
    ksdpec: called for event 13740 prior to event group initialization
    Starting up ORACLE RDBMS Version: 10.2.0.1.0.
    System parameters with non-default values:
    processes = 150
    sga_target = 591396864
    control_files = C:\ORACLE\PRODUCT\10.2.0\ORADATA\ESSAI1\CONTROL01.CTL, C:\ORACLE\PRODUCT\10.2.0\ORADATA\ESSAI1\CONTROL02.CTL, C:\ORACLE\PRODUCT\10.2.0\ORADATA\ESSAI1\CONTROL03.CTL
    db_block_size = 8192
    compatible = 10.2.0.1.0
    log_archive_format = ARC%S_%R.%T
    db_file_multiblock_read_count= 16
    db_recovery_file_dest = C:\oracle\product\10.2.0/flash_recovery_area
    db_recovery_file_dest_size= 2147483648
    undo_management = AUTO
    undo_tablespace = UNDOTBS1
    remote_login_passwordfile= EXCLUSIVE
    db_domain = monde
    dispatchers = (PROTOCOL=TCP) (SERVICE=essai1XDB)
    job_queue_processes = 10
    audit_file_dest = C:\ORACLE\PRODUCT\10.2.0\ADMIN\ESSAI1\ADUMP
    background_dump_dest = C:\ORACLE\PRODUCT\10.2.0\ADMIN\ESSAI1\BDUMP
    user_dump_dest = C:\ORACLE\PRODUCT\10.2.0\ADMIN\ESSAI1\UDUMP
    core_dump_dest = C:\ORACLE\PRODUCT\10.2.0\ADMIN\ESSAI1\CDUMP
    db_name = essai1
    open_cursors = 300
    pga_aggregate_target = 197132288
    PMON started with pid=2, OS id=3328
    PSP0 started with pid=3, OS id=2864
    MMAN started with pid=4, OS id=3292
    DBW0 started with pid=5, OS id=1904
    LGWR started with pid=6, OS id=916
    CKPT started with pid=7, OS id=3384
    SMON started with pid=8, OS id=3360
    RECO started with pid=9, OS id=3408
    CJQ0 started with pid=10, OS id=3132
    MMON started with pid=11, OS id=3428
    Sat Oct 11 19:34:19 2008
    starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
    MMNL started with pid=12, OS id=564
    Sat Oct 11 19:34:19 2008
    starting up 1 shared server(s) ...
    Sat Oct 11 19:34:19 2008
    The input backup piece C:\ORACLE\PRODUCT\10.2.0\DB\ASSISTANTS\DBCA\TEMPLATES\SEED_DATABASE.DFB is in compressed format.
    Full restore complete of datafile 4 to datafile copy C:\ORACLE\PRODUCT\10.2.0\ORADATA\ESSAI1\USERS01.DBF. Elapsed time: 0:00:01
    checkpoint is 534906
    Full restore complete of datafile 2 to datafile copy C:\ORACLE\PRODUCT\10.2.0\ORADATA\ESSAI1\UNDOTBS01.DBF. Elapsed time: 0:00:05
    checkpoint is 534906
    Sat Oct 11 19:35:07 2008
    Full restore complete of datafile 3 to datafile copy C:\ORACLE\PRODUCT\10.2.0\ORADATA\ESSAI1\SYSAUX01.DBF. Elapsed time: 0:00:48
    checkpoint is 534906
    Sat Oct 11 19:36:13 2008
    Full restore complete of datafile 1 to datafile copy C:\ORACLE\PRODUCT\10.2.0\ORADATA\ESSAI1\SYSTEM01.DBF. Elapsed time: 0:01:54
    checkpoint is 534906
    Sat Oct 11 19:36:13 2008
    Create controlfile reuse set database "essai1"
    MAXINSTANCES 8
    MAXLOGHISTORY 1
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    Datafile
    'C:\oracle\product\10.2.0\oradata\essai1\SYSTEM01.DBF',
    'C:\oracle\product\10.2.0\oradata\essai1\UNDOTBS01.DBF',
    'C:\oracle\product\10.2.0\oradata\essai1\SYSAUX01.DBF',
    'C:\oracle\product\10.2.0\oradata\essai1\USERS01.DBF'
    LOGFILE GROUP 1 ('C:\oracle\product\10.2.0/oradata/essai1/redo01.log') SIZE 51200K,
    GROUP 2 ('C:\oracle\product\10.2.0/oradata/essai1/redo02.log') SIZE 51200K,
    GROUP 3 ('C:\oracle\product\10.2.0/oradata/essai1/redo03.log') SIZE 51200K RESETLOGS
    WARNING: Default Temporary Tablespace not specified in CREATE DATABASE command
    Default Temporary Tablespace will be necessary for a locally managed database in future release
    Setting recovery target incarnation to 1
    Sat Oct 11 19:36:15 2008
    Successful mount of redo thread 1, with mount id 1449976685
    Sat Oct 11 19:36:15 2008
    Completed: Create controlfile reuse set database "essai1"
    MAXINSTANCES 8
    MAXLOGHISTORY 1
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    Datafile
    'C:\oracle\product\10.2.0\oradata\essai1\SYSTEM01.DBF',
    'C:\oracle\product\10.2.0\oradata\essai1\UNDOTBS01.DBF',
    'C:\oracle\product\10.2.0\oradata\essai1\SYSAUX01.DBF',
    'C:\oracle\product\10.2.0\oradata\essai1\USERS01.DBF'
    LOGFILE GROUP 1 ('C:\oracle\product\10.2.0/oradata/essai1/redo01.log') SIZE 51200K,
    GROUP 2 ('C:\oracle\product\10.2.0/oradata/essai1/redo02.log') SIZE 51200K,
    GROUP 3 ('C:\oracle\product\10.2.0/oradata/essai1/redo03.log') SIZE 51200K RESETLOGS
    Shutting down instance: further logons disabled
    Sat Oct 11 19:36:16 2008
    Stopping background process CJQ0
    Sat Oct 11 19:36:16 2008
    Stopping background process MMNL
    Sat Oct 11 19:36:16 2008
    Stopping background process MMON
    Sat Oct 11 19:36:17 2008
    Shutting down instance (immediate)
    License high water mark = 1
    Sat Oct 11 19:36:17 2008
    Stopping Job queue slave processes
    Sat Oct 11 19:36:17 2008
    Job queue slave processes stopped
    Waiting for dispatcher 'D000' to shutdown
    All dispatchers and shared servers shutdown
    Sat Oct 11 19:36:18 2008
    ALTER DATABASE CLOSE NORMAL
    ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...
    Sat Oct 11 19:36:18 2008
    ALTER DATABASE DISMOUNT
    Completed: ALTER DATABASE DISMOUNT
    ARCH: Archival disabled due to shutdown: 1089
    Shutting down archive processes
    Archiving is disabled
    Archive process shutdown avoided: 0 active
    Edited by: user10406849 on 08-Oct-2008 19:17

    It's not a backup restoration.
    I'm a newbie, I installed Oracle on my computer. In the installation, Oracle allows to create a database. I didn't change any setting information, excepted set the database's password.
    Oracle was successul installed.
    The database setup (wizard) failed.
    The listener was not created.
    When the wizard step run "Creation and starting an Oracle instance", I get ORA-03113.
    I don't know the log I sent to you is the good log. I'm not sure. My database name is "Essai1"
    Do it is some files that I could send to you?
    thanks for your help.
    Jimmy

  • Need to disable privacy browsing in Safari according to yahoo but don't find the option. New to this.

    Need to disable privacy browser in Safari to access mail but don't find it there. New to iPad!

    On the Safari page tap the + sign in the upper right then private in the lower left. You know private is on when the top of the Safari page is dark with white letters.

  • Strange behaviour of JTree makes it hard to find the mistake.

    Hi,
    I would like to report a problem I actually already solved. But the mistake was not easy to find because of a strange behaviour of the JTree.
    The mistake I made is that I declared a 'treeModel' in a JTree and added new entries to this model but I didnot connect the model to the tree correctely.
    One would expect that simply nothing would happen when calling addNode(). But effectively the first node is added! After calling addNode() again no more nodes are added but the vertical lines of the tree-angles are disapearing (so one thinks the model is connected to the tree correctely because the tree changes its look in a strange way..).
    Whole, compilable code which lets disapear the vertical lines of the tree-angles:
    import javax.swing.*;
    import javax.swing.tree.*;
    public class Strange
        static class MyTree extends JTree
              static DefaultMutableTreeNode root = new  DefaultMutableTreeNode("Root");
              static DefaultTreeModel treeModel = new DefaultTreeModel( root );
              public MyTree()
                   super( root );
              public void addNode()
                   DefaultMutableTreeNode newNode = new DefaultMutableTreeNode("New Node");
                   treeModel.insertNodeInto( newNode, root, root.getChildCount() );
                   expandPath( new javax.swing.tree.TreePath(root) );
         public static void main(String[] args)
              JFrame jframe = new JFrame();
              MyTree mytree = new MyTree();
              jframe.add(mytree);
            jframe.setBounds( 50, 50, 300, 200 );
              jframe.setVisible( true );
              mytree.addNode();
              mytree.addNode();     
              mytree.addNode();
    }Message was edited by:
    MarcMooser

    Simple.... change in constructor super( treeModel );

  • I have a hp635 notebook and I want to add a 5.1 sistem but I don't find the properly drive.

    HP 635 SERIAL:5CB2070CH3 / WIN 7/32
    My audio driver do not support a 5.1 sistem and I don t find one to configure that.

    To make this your syncing computer and not loose any app data do the following:
    - Transfer iTunes purchases to the new computer by:
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    - Transfer other music by using a third-party program like on of those discussed here:
    newer copy
    - Connect the iPod to the computer and make a backup by right clicking on the iPod under Devices in iTunes and select Back Up
    - Restore the iPod from that backup.
    Note that the iPod backup that iTunes makes does not included synced media like apps and music.

  • Impossible to prin with my samsung ML-1520 I don't find the driver?

    my new MacBook Air identify the samsung ML-1520 but ask for a driver. I have the CD with the laser Printer Driver (vert 1.04) but when I try to open the CD it does not work? Impossible to find the correct printer driver on Internet? Any help? Thanks

    It appears that Samsung has no Mac compatible driver for that printer.
    You might try the ML-1510 driver, or contact Samsung for a solution.

  • I don't find the action builder option, in tools menu

    Hi,
    I need to do an action with a button, but can not find the "action builder" option?
    I attached 2 pictures:
    one is taken from Internet ("Tools" menu)
    and the other is of my computer ("Herramientas" menu = "tools" in Spanish language).
    Can someone explain to me because I can not share?
    Thanks

    thanks Radzmar, then I can finish my form! that bad luck.
    I will have to buy the new version... (or finish the form with the trial).

  • I don't find the setup.exe file to begin the install

    Hi! I'm trying to install my CS4 on my new laptop, but the install program doesn't show up automatically. So, I try to find the setup file to run it myself, but it doesn't appear either.
    What can I do? Thanks a lot!
    Daniel.

    I am also having this issue with CS6 Design Premium, no "setup.exe" file on the DVD. How can such a basic file be missing?
    I also tried downloading the install files from online (DesignWebPremium CS6 LS16, DesignWebPremium CS6 LS16.7z) and am having great difficulties installing from them too.
    Grrrrr, why is this soooooo difficult? I also just installed CorelDraw!X6 and that was as easy as falling off a log!

  • I want to download the latest version of firefox but don´t find the buttom where I do that. I question come up if I want to update firefox I went there but dont find where i update it

    I downlouded the extra material there it was buttoms but not the firefox uploading buttom I did not find. I have a mac.

    You can get Firefox 3.6 from http://www.mozilla.com/en-US/firefox/all-older.html

  • HT4623 I don't find the last updat 7.0.6

    I can't update my iOS 7.0.4 to 7.0.6

    What happens when you try to do the update? Did you follow the instructions in the article you linked from?

  • Help me find the mistake,please!

    Hi,
    The code is like this:
    //delete file
    File file=new File(path+name);
    if (file.exists()){
         file.delete();}
    Now I can print path+name correctly,but I cannot delete the corresponding file from the disk.Help me solve the problem,please.
    Thanks in advance.
    bao-intoo

    Hello,
    Probabaly still something wrong with your path.
    use :   String curDir = System.getProperty("user.dir");to get the current default system directory first, then append
    the necessary directories to your "pathname" variable.
    Good Luck !
    Rachel

  • Can you find the mistake in my connection pool?

    Can Someone help me with my connection pool coded below.
    I retrieve the data sent by my connection pool as follows:
    int Id = UserDB.*getUserId(emailAddress)*;
    But int Id always turns out to be 0, no matter what emailAddress I put in.
    My Connection Pool:
    public static int getUserId(String emailAddress)
    ConnectionPool pool = ConnectionPool.getInstance();
    Connection connection = pool.getConnection();
    PreparedStatement ps = null;
    ResultSet rs = null;
    String query = "SELECT UserId FROM User " +
    "WHERE EmailAddress = ?";
    try
    ps = connection.prepareStatement(query);
    ps.setString(1, emailAddress);
    rs = ps.executeQuery();
    int Id = rs.getInt("UserId");
    return Id;
    catch(SQLException e)
    e.printStackTrace();
    return 0;
    finally
    DBUtil.closeResultSet(rs);
    DBUtil.closePreparedStatement(ps);
    pool.freeConnection(connection);
    }

    You forgot "if (rs.next()) { ... get id ...} else { ... email address not found ... }"
    EDIT: Also, the "e.printStackTrace()" should've told you an exception was being thrown.
    Edited by: paul.miner on Jul 10, 2008 11:42 AM

Maybe you are looking for

  • No sound on Treo Pro after bootup

    Hello all, I'm having some problems with my Treo Pro. It's got no audio.. eg with an incoming call, no ring. When I dial out, I cannot hear the call being made or the audio when they answer. I can use the phone with the Treo Earphones installe but st

  • Regarding addition of new field in mb1a, mb1b.

    Hi,           I want to add new field in mb1a or in mb1b in first screen below reason for   movement field and while saving this field value and with line item hav to be fetched and get stored in ztable.           Is it possible. Regards, Natchi.

  • Replacing @@ERROR Based Error Handling With Structured Exception Handling

    Could please any one explain  Thanks

  • Strange things happen in Tiger

    In setting up my new computer I created a new account for my son, just as I had on my old iMac (OS X 10.3.9). But there seem to be a number of problems with it. The Mighty Mouse - which I love - simply doesn't respond as a two button mouse, although

  • Some Apps don't start up anymore after upgrading to BB 10.2.1

    I have upgraded to BB 10.2.1 today and am pleased to see new features and enhancements. I also have to report a few issues though: - startup takes much longer now - several non native apps don't start up anymore. I even reinstalled some, but that did