Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
reshmakala
Creator III
Creator III

Check if file existed and delete

Hello All,

I have a requirement to store the table contents into csv files  if they have data. Everyday the file gets overwritten.\

Table:

LOAD *  Resident Temp;

if NoOfRows('Table')>0 then

STORE Table into Table.csv(txt);

end if

If there is data in the table today, the file gets created but what if I do not have data tomorrow. The file would still be there in the folder. Is there anything I can do to check if file existed and delete before creating a new one?

1 Solution

Accepted Solutions
marcus_sommer

You could include the following in your logic:

if filesize('Table.csv') > 0 then

     EXECUTE cmd.exe /C del Table.csv;

end if

- Marcus

View solution in original post

2 Replies
marcus_sommer

You could include the following in your logic:

if filesize('Table.csv') > 0 then

     EXECUTE cmd.exe /C del Table.csv;

end if

- Marcus

reshmakala
Creator III
Creator III
Author

Thank you!