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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need to Create a folder and Name it by Date

Hi Guys.

I was just thinking to backup my QVD file each day before loading so thought of creating a folder with Name as today date and then create QVD file Name as QVD_NAME_Today_Date.

For Example, I will Create a Folder name 15-Mar-2015 and Inside that folder will create QVD file DIM_EMP_15_MAR_2015 as backup file.

I found that how to create folder but when trying to create dynamic folder name (like 15-Mar-2015), I am not getting desired output.

This is my Script:

SET vFolderName=Today();

SET vFolderPath=D:\Shivendoo\QVD BackUp\Dim Data Source QVD Files\$vFolderName;

EXECUTE cmd.exe /C MD "$vFolderPath";

Please help

1 Solution

Accepted Solutions
Not applicable
Author

Here is the Script to Take Backup of QVD data files before scheduled reloading.

I have plan to keep backup of latest 6 days QVDs.

SET ThousandSep=',';

SET DecimalSep='.';

SET MoneyThousandSep=',';

SET MoneyDecimalSep='.';

SET MoneyFormat='$#,##0.00;-$#,##0.00';

SET TimeFormat='h:mm:ss TT';

SET DateFormat='YYYY-MMM-DD';

SET TimestampFormat='D/MM/YYYY h:mm:ss[.fff] TT';

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

$(Include=d:\shivendoo\qlikview config\qlikview_file_config.txt);

SET vFolderNameTodayI='Date(Today())';

LET vFolderNameToday=$(vFolderNameTodayI);

SET vFolderName7DaysOldI='Date(Today()-7)';

LET vFolderName7DaysOld=$(vFolderName7DaysOldI);

//Create A Folder With Name as Today Date

EXECUTE cmd.exe /C MD "$(vBKPDimFolderPath)\$(vFolderNameToday)";

//Backup QVD Data before scheduled reloading

DIM_EMP_DATA:

LOAD *

FROM $(vDimQVDStoragePath)\DIM_EMP_DATA.QVD (qvd);

//Store the Backuped QVD in FOLDER Named as Date(Today())

STORE DIM_EMP_DATA INTO $(vBKPDimFolderPath)\$(vFolderNameToday)\$(vFolderNameToday)-DIM_EMP_DATA.QVD;

DROP TABLE DIM_EMP_DATA;

//Delete a Folder (& files under it) Named as Date(Today()-7) Using CMD Commands

EXECUTE cmd.exe /C RD /Q /S "$(vBKPDimFolderPath)\$(vFolderName7DaysOld)";

Where qlikview_file_config.txt contains below values.

SET vDimQVDStoragePath='D:\Shivendoo\Dim Data Source QVD Files';

SET vFactQVDStoragePath='D:\Shivendoo\Fact Data Source QVD Files';

SET vBKPDimFolderPath='D:\Shivendoo\QVD BackUp\Dim Data Source QVD Files';

View solution in original post

1 Reply
Not applicable
Author

Here is the Script to Take Backup of QVD data files before scheduled reloading.

I have plan to keep backup of latest 6 days QVDs.

SET ThousandSep=',';

SET DecimalSep='.';

SET MoneyThousandSep=',';

SET MoneyDecimalSep='.';

SET MoneyFormat='$#,##0.00;-$#,##0.00';

SET TimeFormat='h:mm:ss TT';

SET DateFormat='YYYY-MMM-DD';

SET TimestampFormat='D/MM/YYYY h:mm:ss[.fff] TT';

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

$(Include=d:\shivendoo\qlikview config\qlikview_file_config.txt);

SET vFolderNameTodayI='Date(Today())';

LET vFolderNameToday=$(vFolderNameTodayI);

SET vFolderName7DaysOldI='Date(Today()-7)';

LET vFolderName7DaysOld=$(vFolderName7DaysOldI);

//Create A Folder With Name as Today Date

EXECUTE cmd.exe /C MD "$(vBKPDimFolderPath)\$(vFolderNameToday)";

//Backup QVD Data before scheduled reloading

DIM_EMP_DATA:

LOAD *

FROM $(vDimQVDStoragePath)\DIM_EMP_DATA.QVD (qvd);

//Store the Backuped QVD in FOLDER Named as Date(Today())

STORE DIM_EMP_DATA INTO $(vBKPDimFolderPath)\$(vFolderNameToday)\$(vFolderNameToday)-DIM_EMP_DATA.QVD;

DROP TABLE DIM_EMP_DATA;

//Delete a Folder (& files under it) Named as Date(Today()-7) Using CMD Commands

EXECUTE cmd.exe /C RD /Q /S "$(vBKPDimFolderPath)\$(vFolderName7DaysOld)";

Where qlikview_file_config.txt contains below values.

SET vDimQVDStoragePath='D:\Shivendoo\Dim Data Source QVD Files';

SET vFactQVDStoragePath='D:\Shivendoo\Fact Data Source QVD Files';

SET vBKPDimFolderPath='D:\Shivendoo\QVD BackUp\Dim Data Source QVD Files';