Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
As a part of my requirement I am generating QVD's for each month, but I just have to import previous 6 QVD's into my Application. Do we have any control to delete the QVD's which are greater than 6 months from today's date?.
Any possibility of house keeping process?.
Thanks,
You don't need to do it from Qlik at all - a single command in a cmd-file which can run each day is all you need:
delete-QVDs-older-than-180-days.cmd
ForFiles /p "C:\QVDFolder" /m *.QVD /d -180 /c "cmd /c del @file"
Use the Windows Task Scheduler to make the cmd-file run once a day....
You can find a detailed recipe here - ignore the first part about doing it manually with the File Explorer and skip down to the "Delete Files Older Than X Days with a Batch File" section:
Are you fine, If we can call Batch script?
I think that should be fine, btw is that the only way?
You don't need to do it from Qlik at all - a single command in a cmd-file which can run each day is all you need:
delete-QVDs-older-than-180-days.cmd
ForFiles /p "C:\QVDFolder" /m *.QVD /d -180 /c "cmd /c del @file"
Use the Windows Task Scheduler to make the cmd-file run once a day....
You can find a detailed recipe here - ignore the first part about doing it manually with the File Explorer and skip down to the "Delete Files Older Than X Days with a Batch File" section:
Sub DeleteOldFiles (vPath,vNoOfDaysToKeep)
//Move file from C:\APPL Qlik\TestLog to C:\APPL Qlik\Logs\NPrintLog
// LET MoveCmd = 'MOVE $(vPath)"\*.qvd" "C:\APPL Qlik\Logs\NPrintLog\"';
// execute cmd.exe /c "$(MoveCmd)" ;
//Copy files from C:\APPL Qlik\TestLog to C:\APPL Qlik\Logs\NPrintLog
LET CopyCmd = 'COPY $(vPath)"\*.qvd" "C:\APPL Qlik\Logs\NPrintLog\"';
execute cmd.exe /c "$(CopyCmd)" ;
//Delete older 30 days files from C:\APPL Qlik\TestLog
LET DelCmd = 'forfiles /p $(vPath) /s /m *.qvd /d -$(vNoOfDaysToKeep) /c "cmd /c del @file"';
execute cmd.exe /c "$(DelCmd)" ;
End Sub;
Call DeleteOldFiles ('"C:\APPL Qlik\TestLog"',30);
/p Path The Path to search (default=current folder)
/m SrchMask Select files matching the specified search mask
default = *.*
/s Recurse into sub-folders
/c command The command to execute for each file.
/d date Select files with a last modified date greater than or
equal to (+), or less than or equal to (-),
the specified date, using the region specific date format
typically "MM/DD/yyyy" or "DD/MM/yyyy"