Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello qlikers 🙂 ,
I'm saving all the qvds files in a certain folder. Please see the code below.
For example I'm in the folder Qlik/Test/App . In this app I want to save all the the .qvd files in the folder Qlik/Test/App/Backup . But when I'm saving the file in this folder, the method goes into the Backup folder.
How could I stop? I mean with that, when I saved all .qvd Files from the folder Qlik/Test/App and then he is in the folder backup it should break up and goes to the next folder for example Qlik/Test/App2.
I hope you can help me! Thank you in advance!!!
set vRoot = ['Qlik/Test/'];
set vStore = ['Qlik/Test/'];
sub GetQVDFIleNames(Root)
for each FoundFile in filelist( Root & '\*.qvd')
let Namefile=PurgeChar(mid('$(FoundFile)',index('$(FoundFile)' ,'\',-1)+1),'.qvd');
LET Test = SubField('$(Namefile)', '/', -1);
LET ma = SubDirectory;
$(Test):
Load * from $(FoundFile) (qvd);
Store $(Test) into '$(ma)\Backup\$(Test).qvd' (qvd);
drop table $(Test);
EXIT FOR WHEN '$(ma)\Backup' = '$(Namefile)'
next FoundFile
for each SubDirectory in dirlist( Root & '\*' )
call GetQVDFIleNames(SubDirectory)
next SubDirectory
end sub
Call GetQVDFIleNames($(vRoot))
can you try with this version :
set vRoot = ['Qlik/Test/'];
set vStore = ['Qlik/Test/'];
sub GetQVDFIleNames(Root)
for each FoundFile in filelist( Root & '\*.qvd')
let Namefile=PurgeChar(mid('$(FoundFile)',index('$(FoundFile)' ,'\',-1)+1),'.qvd');
LET Test = SubField('$(Namefile)', '/', -1);
LET ma = SubDirectory;
$(Test):
Load * from $(FoundFile) (qvd);
Store $(Test) into '$(ma)\Backup\$(Test).qvd' (qvd);
drop table $(Test);
next FoundFile
for each SubDirectory in dirlist( Root & '\*' )
let Namefile2=mid('$(SubDirectory)',index('$(SubDirectory)' ,'\',-1)+1);
let flag=wildmatch('$(Namefile2)','*Backup*');
if '$(flag)'<1 then
call GetQVDFIleNames(SubDirectory)
endif
next SubDirectory
end sub
Call GetQVDFIleNames($(vRoot))
can you try with this version :
set vRoot = ['Qlik/Test/'];
set vStore = ['Qlik/Test/'];
sub GetQVDFIleNames(Root)
for each FoundFile in filelist( Root & '\*.qvd')
let Namefile=PurgeChar(mid('$(FoundFile)',index('$(FoundFile)' ,'\',-1)+1),'.qvd');
LET Test = SubField('$(Namefile)', '/', -1);
LET ma = SubDirectory;
$(Test):
Load * from $(FoundFile) (qvd);
Store $(Test) into '$(ma)\Backup\$(Test).qvd' (qvd);
drop table $(Test);
next FoundFile
for each SubDirectory in dirlist( Root & '\*' )
let Namefile2=mid('$(SubDirectory)',index('$(SubDirectory)' ,'\',-1)+1);
let flag=wildmatch('$(Namefile2)','*Backup*');
if '$(flag)'<1 then
call GetQVDFIleNames(SubDirectory)
endif
next SubDirectory
end sub
Call GetQVDFIleNames($(vRoot))
Thank you very much!
Unfortunately is not exactly what I need.
This is my folder Structure
In 'Versuch' there are subfolders for example Versuch/AI, Versuch/Reviews. In this Subfolders there are .qvd files.
I want to store all .qvd files from the subfolder Versuch/Reviews in the folder Versuch/Reviews/Backup. For the subfolder all .qvd files in the folder Versuch/AI/Backup. But the subfolder Versuch/Reviews could have another subfolder Versuch/Reviews/Yesterday all .qvd files should be also saved in Versuch/Reviews/Backup.
My problem is when I'm trying to save all .qvd files from Versuch/Reviews in Versuch/Reviews/Backup he also considered the Versuch/Reviews/Backup folder. But he should skip only this folder Versuch/Reviews/Backup .
Do you know what I mean with that? 🙂
Thank you in advance!! 🙂
Can you share a simple exemple the fullpath of folder and sub
Sure!
The Main path:
Qlik/Versuch
The Subfolders with files:
Qlik/Versuch/Review
Qlik/Versuch/Review/test1.qvd
Qlik/Versuch/Review/test2.qvd
Qlik/Versuch/Review/Test/test3.qvd
Qlik/Versuch/AI
Qlik/Versuch/AI/test4.qvd
Qlik/Versuch/Service
Qlik/Versuch/Service/test5.qvd
Qlik/Versuch/Service/test6.qvd
.....
Where it should save Qlik/Versuch/PLACEHOLDER/Backup
Qlik/Versuch/Service/Backup, Qlik/Versuch/AI/Backup, Qlik/Review/Backup
I hope this will help you! 🙂
Steven,
the above script skip all subfolder with "*Backup*"
this what I understood, when you tested what is the result ?
The result is, that the script only writes on qvd in the last subfolder.
Not in every subfolder, and only one .qvd! 🙂