Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Can any one please help me on below requirement.
I have a Daily refresh Extract app. By refreshing daily one QVD is generated in the Truncate folder like below.
But due to daily refresh the folder size is increasing.
Can any one please help on writing the script for , how to keep the Today date qvd and last 5 Mondays QVDs in the folder by deleting remaining QVDs.
Please find the below attached qvd folder.
Thanks in advance.
Hi,
You can do it with the following steps:
Sample script as follows:
Set vQVD_Path = 'C:\Temp\QVDs';
Set vWeeks = 5; // How many Mondays you want to keep
For Each vFile in filelist ('$(vQVD_Path)\'&'\*.qvd')
vFileName = SubField(vFile,'\',-1);
vDay = Date(Date#(Left(vFileName,8),'YYYYMMDD'));
vDayName = WeekDay(vDay);
If Not((vDayName = 'mon' and vDay > Today() - vWeeks * 7) or vDay = Today()) then
Execute cmd.exe /C del "$(vFile)";
EndIf;
Next vFile;
You will need to disable Standard mode in Qlik Sense (https://help.qlik.com/en-US/sense/November2019/Subsystems/Hub/Content/Sense_Hub/LoadData/disable-sta...) to be able to run the Execute command. Also make sure the Qlik Sense service account has permission to delete the QVD files.
Hope this helps!
BR,
Vu Nguyen