Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jmialoundama
Specialist
Specialist

Qlik Sense - Delete all files (CSV FILES) in folder

 Hello, I want to delete all the CSV files at the end of my loading of data that I have in this directory: lib://APPS/*.csv

I saw by looking a bit that it was possible to delete files in a folder using a macro.

However I do not know how to insert a macro under QLIK SENSE and especially I do not know if QLIK SENSE takes into account the macro.

Thanks in advance 🙂

7 Replies
timpoismans
Specialist
Specialist

As far as I know, Qlik Sense doesn't support macro's. So deleting a file out of a Qlik Sense script isn't possible, I think.

jmialoundama
Specialist
Specialist
Author

Hello Timpoismans

Thanks you for you reply. 

I use this script but it's doesn't works : 

 

LET vFileDate = Date(Left(right(file,28),8)); // Gets the year portion from the filename
LET vMaxDate = Rangemax(vFileDate, vMaxDate); // Gets the max year for every iteration
if filesize('lib://DATA_Imports (omnium_istya4)/APPS Approvisionnement Logvad/$(vMaxDate).csv') > 0 then

     EXECUTE cmd.exe /c del $(vMaxDate).csv;

end if;


 

 

 

 

 

 

timpoismans
Specialist
Specialist

Yes, this was an option that you could select in the settings of QlikView. 

But Qlik Sense doesn't have any of the settings, so we can't give our app these rights. Thus, we can't delete files in a folder from the script.

jmialoundama
Specialist
Specialist
Author

Oh ok  ! 😕 

So it is not possible to delete files from the script for the moment in qlik sense?

timpoismans
Specialist
Specialist

As far as I know, no, it's not possible.
At least not with a direct command.

There might perhaps be a workaround with calling a batch script through the Qlik Sense script, but I've got no experience in that, sorry.
jmialoundama
Specialist
Specialist
Author

Ok thanks you so much for you help 

teiswamsler
Partner - Creator III
Partner - Creator III

Hi @jmialoundama

I can be done, but you need to change the envioment to legacy mode, NOT RECOMMENDED.

https://help.qlik.com/en-US/sense/November2018/Subsystems/Hub/Content/Sense_Hub/LoadData/disable-sta...

 

Br.

Teis