Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Size of file

  1. #1

    Default Size of file

    I have two question :
    1- It's possible to know the size of file by javascipt or other method please?

    2- I use this step "Transfert fichier via HTTP 1" to download a file by HTTP, and in the case "fichier cible" I fixed the path of file, but my problem is :
    if there is no file to download --> there is a file to creat

    or me I want:
    if there is no file to download --> there is no file to creat
    if there is a file to download --> there is a file to creat

    I hope that you understand me.
    Please!! c urgent

  2. #2


    Hi chaddou2010,

    The problem with none existing files with HTTP cant be solved by Kettle.
    Every HTTP server will send an error page which contains status 404.
    Please verify this with a browser of your choice!

    I would solve this by saving manually the error page sent by your HTTP server to a fixed file. My Kettle Job would contain a "File Compare" step to detect whether the newly got file is the error page.
    That is not possible if the error page contains the current date or time. Then you have to detect the 404 code with something else... be creative.

    You can also try to use the hop evaluation. I do not know if the HTTP step would fail if the HTTP status code is something else than 200. If so right click the hop > Evaluation > Follow when result is false. The hop turns red when it is active in case of error.

    Greets, Christoph
    21 is only half the truth

  3. #3


    Thanks a lot for your attention and what about the first question please?
    Last edited by chaddou2010; 09-22-2008 at 07:21 AM.

  4. #4


    Hi chaddou2010,

    I do not know a Javascript function so far. But you can do this within Java and Javascript is able to call Java. And your Java class you write something like:
    File file = new File("infilename");
    // Get the number of bytes in the file
    long length = file.length();
    To use Java you have to add your class or jar to the classpath. In the Javascript the first statement is "java;"!

    Last edited by christophWeißenborn; 09-22-2008 at 10:09 AM.
    21 is only half the truth

  5. #5
    DEinspanjer Guest


    In the JS step, look under Transform Functions | File Functions. there is a getFileSize() method.

  6. #6


    DEinspanjer is right.
    But you have to use version 3.1 currently under development.
    In 3.0.x file functions were not available so far.
    21 is only half the truth

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.