How to access total duration of a folder

I want to be able to see the total duration of all video clips in a given Finder folder.  I want to use the number as a yardstick to know how much of a given project I've completed.  Any ideas how to accomplish this?  Thank you in advance.

The java.io.File class lets you do that. There's an isDirectory() method which tells you whether it's a directory, and a listFiles() method which gives you the files contained in a directory. That's out of my memory so check it against the documentation.

Similar Messages

  • How to know total size of a folder? plz help

    hi,
    I want to know total size of a folder in which other folders & files r there. I know how to find the size of a particular file but not directory. Plz send me code.

    hi,
    I want to know total size of a folder in which other
    folders & files r there. I know how to find the size
    of a particular file but not directory. Plz send me
    code.you could write the code yourself. you could use a
    recursive method that builds a collection of files and
    then loop through each file and add it's size to a total.
    send a directory to this method, get a File[ ], then check
    file.isDirectory()
    if not, get the size, if so do file.listFiles() and go again.

  • How to access the images stored in folder which is kept inside theapplicati

    Iam new to java..
    I want to display the images (.jpeg,,.gif, flash) which are kept in one folder
    Using Jsp...
    Its Executing fine in local system..
    Its not working 1)when i execute that jsp from other system
    2)if i give the full url then only its executing in local system
    Please help me...
    thanks in advance...
    by Priya
    <%@ page import="java.io.*"%>
    <html>
    <head>
    <title>Movie Details</title>
    </head>
    <body text="#000000" bgcolor="#FFFFFF">
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber1">
    <%
    File f=new File("..E:\application\Images");
    File []f2=f.listFiles();
    for(int ii=0;ii<f2.length;ii++)
    if(f2[ii].isFile())
    String fname=f2[ii].getPath();
    %>
    <tr>
    <td width="87%"><%=fname%> </td>
    <td width="14%"><img border="0" src="<%=fname%>" width="150" height="100" ></td>
    </tr>
    <%
    System.out.println(f2[ii].getPath());
    %>
    </table>
    </body>
    </html>

    Hi,
    Well i guess a Simple concept of a image servlet can cater your requirement here.
    checkout the below example of how to do it
    Configurations needed in /WEB-INF/web.xml:
    <servlet>
        <servlet-name>ImageServlet</servlet-name>
        <servlet-class>com.ImageServlet</servlet-class>
        <init-param>
           <param-name>backupFolderPath</param-name>
           <param-value>E:/application/Images</param-name>
           <!--Could use any backup folder Available on your Server and make sure we place a image file named noImage.gif which indicates that there is no file as such-->
        </init-param>
         <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>DownloadServlet</servlet-name>
        <url-pattern>/Image</url-pattern>
    </servlet-mapping>
    ImageServlet.java:
    package com;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    *@Author RaHuL
    /**Image Servlet
    *  which could be accessed Image?fid=fileName
    *  or
    *  http://HOST_NAME:APPLN_PORT/ApplnContext/Image?fid=fileName
    public class DownloadServlet extends HttpServlet{
      private static String filePath = new String();
      private static boolean dirExists = false;
      public void init(ServletConfig config){
          // Acquiring Backup Folder Part
          filePath = config.getInitParameter("backupFolderPath");
          dirExists = new File(filePath).exists();      
      private void processAction(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
           // getting fileName which user is requesting for
           String fileName = request.getParameter("fid");
           //Building the filePath
           StringBuffer  tFile = new StringBuffer();
           tFile.append(filePath);    
           tFile.append(fileName); 
           boolean exists = new File(tFile.toString()).exists();
           FileInputStream input = null;
           BufferedOutputStream output = null; 
           int contentLength = 0;
           // Checking whether the file Exists or not      
           if(exists){                  
            try{
                // Getting the Mime-Type
                String contentType = this.getContentType(tFile.toString());          
                input = new FileInputStream(tFile.toString());
                contentLength = input.available();
                response.setContentType(contentType);
                response.setContentLength(contentLength);
                 String contentDispo = "";
                  try{
                     contentDispo = request.getParameter("coid");
                  }catch(Exception exp){
                 if(contentDispo != null && contentDispo.equals("69125"))
                   response.setHeader("Content-Disposition","attachment;filename=\""+fileName+"\"");       
                this.exportFile(input,response.getOutputStream());
             }catch(Exception exp){
                 exp.printStackTrace();
                 this.getServletContext().log("Exception Occured:"+exp.getMessage());
                 throw new ServletException(exp.getMessage());
           }else{
              try{
                 // Getting the Mime-Type
                String contentType = this.getContentType(filePath+"noImage.gif");          
                input = new FileInputStream(filePath+"noImage.gif");
                contentLength = input.available();
                response.setContentType(contentType);
                response.setContentLength(contentLength);
                this.exportFile(input,response.getOutputStream());
              }catch(Exception exp){
                 exp.printStackTrace();
                 this.getServletContext().log("Exception Occured:"+exp.getMessage());
                 throw new ServletException(exp.getMessage());
      /** Gets the appropriate ContentType of the File*/
      private String getContentType(String fileName){
            String url = java.net.URLConnection.guessContentTypeFromName(fileName);
               if(url == null)
                 return "application/octet-stream";
               else
                 return url;
           or one may use
           return new  javax.activation.MimetypesFileTypeMap().getContentType(fileName);
           NOTE: Do not forget to add activation.jar file in the classpath
      /** Prints the Image Response on the Output Stream*/
      private void exportFile(InputStream input,OutputStream out) throws ServletException,IOException{
             try{
                    output = new BufferedOutputStream(out);
                    while ( contentLength-- > 0 ) {
                       output.write(input.read());
                    output.flush();
              }catch(IOException e) {
                    e.printStackTrace();
                     this.getServletContext().log("Exception Occured:"+e.getMessage());
                     throw new IOException(e.getMessage());
              } finally {
                   if (output != null) {
                       try {
                          output.close();
                      } catch (IOException ie) {                     
                            ie.printStackTrace();
                         this.getServletContext().log("Exception Occured:"+e.getMessage());
                         throw new IOException(ie.getMessage());
      /** HttpServlet.doGet(request,response) Method*/
      public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{       
            // Calling  respective Action Method to Provide File Service
            this.processAction(request,response); 
      /** HttpServlet.doPost(request,response) Method*/
      public void doGet(HttpServletRequest request,HttpServletResponse response) throws         ServletException,IOException{
            // Calling  respective Action Method to Provide File Service
            this.processAction(request,response); 
    NOTE: The following code could be used to provide service to stream any sort of files with any sort of content
    with some minor modications.
    Inorder to access all the images you can restructure your jsp like the one below
    JSP:
    <!--
         And say we have are storing Image name & Movie details in the database and we are created a collection
         of all the database results like bean here is how we would display all the details with images
         Say you wrote a query to findout Moviename,timings,Hall Number & pictureFileName
         example:
            Movie: DIE HARD 4.0
            Timings: 10:00AM,2:00PM,9:15PM
            Hall NUmbers: 1,1,2,4 
            pictureFileName: die_hard_4.jpg
             or
            Movie: Transformers
            Timings: 11:20AM,2:20PM,10:15PM
            Hall NUmbers: 2,3,1,5 
            pictureFileName: transformers.jpg
         say you are saving the information in a dtoBean with properties like
          public class MovieBean{
             private String movieName;
             private String timings;
             private String pictureFileName;
             /* and followed by getters & setter of all those*/
          and say we have queried the database and finally collected an ArrayList<MovieBean> from the query results and
          saving it within the scope of session with the attribute name "MovieList"
    -->
    <%@ page language="java"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
    <html>
    <head>
    <title>Movie Details</title>
    </head>
    <body text="#000000" bgcolor="#FFFFFF">
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber1">
    <thead>
    <tr>
        <td>Movie Name</td>
        <td>Timings</td>
        <td>Hall Numbers</td>
        <td>Poster</td>
    </tr>
    </thead>
    <tbody>
    <c:forEach var="movieBean" items="${sessionScope.MovieList}">
        <tr>
             <td><c:out value="${movieBean.movieName}"/></td>
             <td><c:out value="${movieBean.timings}"/></td>
             <td><c:out value="${movieBean.hallNo}"/></td>
             <!-- Here is where we are making use of image servlet and trying to retrive images -->
             <td><img src="Image?fid=<c:out value="${movieBean.pictureFileName}"/>" align="center" width="30" height="30"/></td>
        </tr> 
    </c:forEach>
    </tbody>
    </table>
    </body>
    </html>Hope this might help,If that does do not forget to assign the duke stars which you promised :)
    REGARDS,
    RaHuL

  • How to Access Total Number Of Pages inside code

    Hi All,
    I would like to get the total number of pages in the report,inside the trigger.
    How can i access this value inside code.
    Pls Help me
    Thanks and Regards
    Binu

    I think this is not possible inside the code, because this value is deteremined after the code is executed and during the formatting of the report.

  • How to access sent folder in mail?

    couple of questions:
    1) how to access sent mail folder to assure that mail has been sent?
    2) how to attach a document to email?
    3) how to create additional folders in mail?
    using att wifi

    I came across your post and thought I'd share Ivan54's post as an answer to your question:
    https://discussions.apple.com/message/13103795#13103795
    The main thing is that it should be on landscape view to access the folders in your email accounts.
    Hope this helps.

  • How to access virtual folder in oracle apps 11i?

    Hi,
    how to access virtual folder in oracle apps 11i?
    Version=11.5.10.2
    please help
    Thanks,

    I'd use BI Publisher (XML Publisher) Bursting.
    Regards,
    Gareth
    http://garethroberts.blogspot.com
    http://www.virtuate.com

  • I have recently purchased a new computer and photoshop element. It looks like its downloaded it but I don't know how to access it. it says file are ready...down load files have been extracted and saved to folder....launch PS elements and open specific fol

    I have recently purchased a new computer and photoshop element. It looks like its downloaded it but I don't know how to access it. it says file are ready...down load files have been extracted and saved to folder....launch PS elements and open specific folder. it looks like it downloads. It then keeps taking me back to this page. Im not sure where to go next

    if you have a win os you should have dl'd an exe and a 7z file.
    put both in the same directory and double click the exe.

  • Is there a solution for iphone 4 too like iphone5, It doesnt have tab Cellular. How to check call duration for total dialled calls (after resting) on a particular day?

    How to check call duration for total dialled calls (after resting) on a particular day in iphone 4?
    Is there a solution like iphone 5, i.e.Settings > Cellular.

    if the device is unlocked cellular is called mobile

  • C7 how to access the PRIVATE folder in phone memor...

    C7-00 how to access the PRIVATE folder in phone memory?
    Meaning the folder C:\private
    With X-plore you can see the folder but it is marked as 0 kb.
    Edit: reason for this is that I had Angry Birds installed on memory C:
    Then I had changed my phones default game install memory to E: at the OVI store setup in the phone. On Monday OVI suggested that I should update the AB and so I did.
    Now it installed the new version to memory E: and all my game progress was gone.
    Just need to see if the save game still lays on C:\private\20030e51.
    Solved!
    Go to Solution.

    Ah, I'm sorry - I thought it was the private folder in C drive that I had managed to get into the previous week but it was the private folder in mass storage ...
    If you want to thank someone, just click on the blue star at the bottom of their post

  • How to access the archive folder in jive forums programiticaaly

    hi
    how to access the archive folder in jive forums programitically using weblogic 10.3
    Thanks
    Rani

    Ah, I'm sorry - I thought it was the private folder in C drive that I had managed to get into the previous week but it was the private folder in mass storage ...
    If you want to thank someone, just click on the blue star at the bottom of their post

  • I created a folder from my camera roll and shared with my icloud acct, can't figure out how to access it from my computer?

    I created a folder from my camera roll and shared with my icloud acct, can't figure out how to access it from my computer? I log onto icloud and can't find anywhere where "shared" photos are..

    You need Mountain Lion (10.8.2 or higher) and iPhoto '11 (9.4 or higher) or Aperture 3.4 to get shared photo streams on Mac.
    Another option to transfer them is to either import them to iPhoto using your usb cable, as explained here:http://support.apple.com/kb/HT4083, or to us an app like PhotoSync to transfer them to your Mac over your wifi.  (PhotoSync will also transfer albums, not just photos from the camera roll.)

  • How do I regain write access to my itunes media folder?

    How do I regain write access to my itunes media folder?

    Navigate to the folder in Finder, Get Info and if the permissions are not set to read and write, change them. Then click the lock, enter your Admin password and click the Gear to apply to all enclosed folders.

  • How to access .asmx Web Service using JAVA? Newbie

    Hello Experts,
    Currently, I have a project where in I have to access a ,NET web service. It is made of C#. I just want to ask how will I start the accessing process? I made this simple equation on how my project is.
    Java Project + C#.Net Web Service = Integration
    1. Do i need to create a Web Service too for the Java Project? If yes, What are the necessary tools needed for the creation of this Java Web Service?
    2. The .NET Web Service is available online. (It is made by other people).
    3. Based on the equation, what is the equivalent technology for the + sign?
    4. Can you site a concrete example for accessing a web service?
    5. I'm new here. Totally I have no idea where to start.
    6. Thank you experts.
    Edited by: Benedict.Aluan on 05 30, 08 1:38 PM
    Edited by: Benedict.Aluan on 05 30, 08 1:39 PM

    Hello
    Thanks a lot for your help ...
    I am developing simple J2EE based web service client using IBM WSAD 5.1. I have used the following code to call .asmx web service in Java
    String url = "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl";
         String namespace = "http://tempuri.org/";
         name = request.getParameter("txtName");
         try
              System.out.println("In Internet Service");
              ServiceFactory factory = ServiceFactory.newInstance();
              Service serv = factory.createService(new URL(url),new QName(namespace,"TempConvert"));
              System.out.println("Got Service......");
              Call obj = (Call)serv.createCall();
              System.out.println("Got Call......");
              obj.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY,"");
              obj.setProperty(Call.OPERATION_STYLE_PROPERTY,"wrapped");
              obj.setTargetEndpointAddress(url);
              obj.setPortTypeName(new QName(namespace,"TempConvertSoap"));
              obj.setOperationName(new QName(namespace,"FahrenheitToCelsius"));
              obj.addParameter("param1",XMLType.XSD_STRING,String.class,ParameterMode.IN);
              obj.setReturnType(XMLType.XSD_STRING);
              System.out.println("Parameters Set.....");
              Object[] params = new Object[]{name};
              k = (String)obj.invoke(params);
              System.out.println("Result: "+k);
         catch(Exception e)
            System.out.println("Exception is : "+e);
        }But this code is throwing exception that
    Invalid Address "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl"I have also tried this URL with Java Proxy. But it showing the same error.
    Plz can u tell me how to access .asmx web service ?
    Waiting 4 reply.

  • How can I get newstand in a folder on a ipad2 ?

    How can I get newstand in a folder on iPad 2 ?

    I've done it on both my iPad and my Touch. what I do is put 3 icons next to each other. newsstand and two others. use the other two to make the folder, then grab  the newsstand the second the folder is made.
    Newsstand is totally nonfunctional when it's in the folder and it will crash your ipad (as in try to open it and it goes back to the home screen). ALso, it seems when you do any upgrades, Apple 'kindly' puts newsstand back outside the folder.

  • HT4436 Is there a way to connect my iCloud acct. so that my regular email address is my user name instead of the .me email address? I don't even know how to access my very old .me address.

    Anyone know if you can replace your .me email address for your regular email address? I'm trying to set up my iCloud acct. on my iPhone but the default email adddress is my .me email which I never used and do not know the password for. When I use the Forgot Password link, it sends to my .me email address
    and I never used it and don't know how to access that address. Arg. Anyway to clean slate and permanently eliminate the .me thing?

    I copied the iTunes file from the external drive and it's in both places.  I thought all I would need is the iTunes program (which I downloaded to new computer) and my iTunes library file.  There must be something else that's missing.  My iTunes library looks the same on the new computer as it does when I open it on the external drive.  If I click on an iTunes library song from my new computer, it will only play if I have the external drive plugged in.
    My back-up drive is a mess.  I have multiple copies of music, video, photo, and document files and I don't know how that happened. ={  Obviously, I don't know how to back up stuff properly and there are back-up files extending over a 6- to 8-year period.  I think all I did was just drag and drop the main folders from the back-up drive to the same main folders on the C: drive.  Also (and I'm kind of fuzzy on this) Windows used to automatically save music files in a folder within my document files (which makes no sense to me).  As my Jewish friends would say, "Oy Vey!" 

Maybe you are looking for