Fetching file Name,file Path and size from directories and exporting them to excel sheet.

                  In this tutorial we will explore the usage of File input & output operations.we will take a small requirement to learn the concept. Basic requirement that we are dealing in this tutorial is that when user enter the path of the parent directory,we need to get into that parent directory and pull out all the file names,file path and size of the files.we need to extract the files in the sub-directory as well.To make user task of tracking down the file details we are providing the o/p in the form of excel sheet.

                 By the end of the tutorial you will be able to Fetching file Name,file Path and size from directories and exporting them to excel sheet using Java programming language.

In order to complete this project we need.

  • Java 1.5 or above.
  • IDE for making things easy(optional) I am using eclipse for my convince.
  • jxl jar file(click here to download jxl jar).
  • MS excel to show the output.
steps to achieve this requirement.

  • create a java project in the IDE.
  • create two class with names client class and logic class.
  • add the jxl jar to the project.(Right click on the project and go to build path ->configure build path. as shown in the figure.
    build path
  • add the jxl jar by clicking on the add external jar in the library tab in the top section.
  • library



















Code



  • now copy the code into the respective classes and go through the follow by reading the comments.
  • save the project and run the project.give the directory path and excel path to which you want to save the content.
  • note:-every time give new excel sheet so that details will not override.




thats it from this tutorial ..... hope you liked it. like,share and comment.
    Share on Google Plus

    About Sandeep Ram

      Blogger Comment
      Facebook Comment

    0 comments:

    Post a Comment