Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Component tFileDelete cannot delete file created by tFileOutputExcel

Hello,
I am trying to delete files created with the component tFileOutputExcel depending
on a condition (deleteIfEmpty), but they cannot be deleted.
To simplify this sample, I substituted the component deleteIfEmpty by the component
tFileDelete, and deactivated deleteIfEmpty (see image).
Looking at the flow, all created files (with tFileOutputExcel) should be deleted by the tFileDelete
component, but they are not being deleted. It looks like the output file is still opened and cannot
be deleted.
I tried to connect (with "OnOK") the component "set Vars" and "tFileInputExcel_1" and none of
them is working.
Any hints?
- the component deleteIfEmpty should delete the file depending on the number of written rows
(i.e. globalMap.get("tFileOutputExcel_1_NB_LINE"))
- the code responsible for the deletion returns always "file could not be deleted":
java.io.File df = new java.io.File((String)globalMap.get("currentOutputFileName"));
if (df.exists() && df.isFile()) {
if (df.delete()) {
System.out.println("file deleted");
} else {
System.out.println("file could not be deleted");
}
Thanks!
eripet
---
Using...
TOS Version: 2.2.2
Language: Java
Labels (3)
12 Replies
Anonymous
Not applicable
Author

Hi namaravaadi,
Is there any error printed on console when you check out "Fail on error" option in TalendHelpCenter:tFileDelete component? Would you mind uploading your whole job design screenshot into forum so that we can get your situation more precisely.
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi,
I've encountered a similar problem:
I use tFileInputPositional to read data from a file, tPostgresqlOutput (with Die on error option) to write them to database and a tPostJob for moving (tFileCopy with Remove source file option) the file to another directory at the end of the job
tPostJob works as finally in Java so once tPostgresqlOutput fails it is executed anyway (and this is what I want), but in such case I got the following error:
The source file could not be removed from the folder because it is open or you only have read-only rights.
Can you help me?
Best regards,
Pawel
Anonymous
Not applicable
Author

Mostly it is a matter of job design. E.g. if you try to delete the file while the component has not reached its end state.
Could you show us your job design?
To be sure to be able to delete the file use the OnSubjobOk trigger from the subjob writing into the file to call the next subjob in which you delete the file.