Delete file

One Star

Delete file

Hello;
I have to delete a file.txt . How can pass the file name from an interface to my job done with T.O.S.
i.e i have to choice a file name from a list in interface to be deleted later by running T.O.S 's job.
Can you please help me
Thank you.
Seventeen Stars

Re: Delete file

hi romyos
int the context view , choose value as trees and check option button prompt !
You'll have a dialog box where you can initialize your context value
hope it'll help you
++
One Star

Re: Delete file

hello;
thank you for your anser;
In realite I transported my project to NetBeans.Here I have an interface from i can choose a file name; but i don't know how to pass this file name to talend's job .
Can you lease help me because i'am young with Talend.
Thank you
Community Manager

Re: Delete file

Hello Romyos
1) Define a context variable: filePath in your job, when you delete the file, you should use the context variable as file path in your job.
2) Pass the file path to main method in eclipse, eg:
package excel;
public class Talend {
public static void main(String[] args) {
Talend t = new Talend();
t.test();
}
public void test() {
String[] args = { "--context_param filePath=d:/text.txt" };
test2.test3_0_1.test3.main(args);
}
}

About '--context_param filePath=d:/text.txt', in fact we set the value of context dynamically, see 1615.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Delete file

Hello;
thank you for your help. Un fortunately it dosn't work.
It was an exception in component tFiledelete("java.lang.NullPointerException")
I upload slots witch describes my job.
Please can you resolve my problem
Thank you
Community Manager

Re: Delete file

Hello Romyos
I see that you define a context variable: nom, its data type is File and then set the value of context variable:
--context_param file=c:/test.txt
the correct way is that: the data type should be string and the value of context variable is:
--context_param nom=c:/test.txt //nom is the variable name.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Delete file

Hello;
it dosn't work Shong.
I don't know where's the problem.
Can you please see my new slots please.
Thank you very much.
Community Manager

Re: Delete file

Hello
Please see my screenshots.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Delete file

hello Shong
Thank you for your help.
Problem resolved
One Star

Re: Delete file

Hi. I runned into that damn problem too. And after days of searching I finally found this software: Delete Long Path File Tool.
It's GREAT. You can find it here: www.deletelongfile.com