Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: If file exist

  1. #1
    Join Date
    Jun 2007
    Posts
    138

    Default If file exist

    I m confused over a simple process...

    Usecase is like dat,I am receiving file name as parameter.If the same name of file comes then file should be appended,Else newfile should be created.

    I knw abt Get file name component.But is there any componenet that can return a boolean variable ,if file exist...

    I can do like ,set a variable from input of Get file name under a directory.Then compare it with input,which is a file name only.If both matches then file exist ,else not.

    Plz mind that I need a transformation,not a Job..

    Please...Please Guide me..!!



    Thanx....
    Last edited by kedar mehta; 11-06-2007 at 11:10 AM.
    Regards,
    kedar.mehta@tcs.com ,
    Tata consultancies Ltd

  2. #2

    Default

    Hi kedar, in the Java script step (mod) STEP you have a fileExists function ("Transform functions \Special functions).

    Rgs

    Samatar

  3. #3
    Join Date
    May 2006
    Posts
    4,882

    Default

    @kedar: And remember all steps in a transformation are run in parallel... so probably your idea won't work... even before you determine whether the file exists all steps will have started running.

    Regards,
    Sven

  4. #4
    Join Date
    Jun 2007
    Posts
    138

    Default File output step

    Thanx to all..

    @ Samatar: I am not able to find,Transform functions \Special functions.I am using Kettle 2.5(/2.4). Are u talking abt Javascript Componenet,N suggesting me to use Java Api,File exist?

    Indeed my usecase is,If filename passed from Java exist then,The fil should be appended,Or else create new.I suppose file output component works in same way.If file name given already exist then it appends into file.(if i have selected checkbox,Append the file.)

    Wat say?M I right?
    Regards,
    kedar.mehta@tcs.com ,
    Tata consultancies Ltd

  5. #5
    Join Date
    May 2006
    Posts
    4,882

    Default

    Put append "on" on text output file and you're ready... when no file is present yet it will be created.

    Regards,
    Sven

  6. #6
    Join Date
    Jun 2007
    Posts
    138

    Default Working...

    Thanx Sven..

    My guess was right..
    I tried Ur suggestion,N it's working fine...!!

    Thanx All...
    Regards,
    kedar.mehta@tcs.com ,
    Tata consultancies Ltd

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.