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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
simonaubert
Partner - Specialist II
Partner - Specialist II

Deleting Files from Script : a Powershell solution

Hello all,

Here is a solution of mine to delete files from script with the help of powershell

let v_path_file_to_delete_via_powershell='D:\Sense\AppsDocument\08_TMP_SUPPRESSION_FICHIER\New Text Document*.txt';
let v_cmd_suppresion='#>'&
chr(10)&chr(13)&'Remove-Item -Path '&chr(39)&'$(v_path_file_to_delete_via_powershell)'&chr(39)&' -Recurse'&chr(10)&chr(13)&'#';

let v_titre_suppresion='<#'; //pour escaper sur Powershell
NoConcatenate
SCF_DROP_FILE:
LOAD text('$(v_cmd_suppresion)') as [$(v_titre_suppresion)]
AutoGenerate(1);

store SCF_DROP_FILE into [lib://CONFIG_06_POWERSHELL/SCF_DROP_FILE.PS1](txt);

Let vServer = 'localhost';
let v_task_reellement_lancee='☠TEST_SUPPRESSION_FICHIER☠';
 Let vTaskName = '$(v_task_reellement_lancee)';
          Let vURL = '"https://$(vServer):4242/qrs/task/start?name=$(vTaskName)"';
          trace --> Url Testée Sub Declencheur $(vURL);

          LIB CONNECT TO 'REST_TASK_LAUNCHER';
          RestTable:
          SQL SELECT
          FROM JSON (wrap on) "root"
          WITH CONNECTION ( URL $(vURL) );
          Drop Table RestTable;
exit script;

 

 

You can fin more info about REST_TASK_LAUNCHER here : 

https://community.qlik.com/t5/Integration-Extension-APIs/Reloading-task-from-script-authentication-w...


You can also vote for this idea to have that feature natively
https://community.qlik.com/t5/Suggest-an-Idea/Delete-Files-from-a-lib/idi-p/1689857

Best regards,

Simon

Bi Consultant (Dataviz & Dataprep) @ Business & Decision
Labels (2)
1 Reply
simonaubert
Partner - Specialist II
Partner - Specialist II
Author

Forgot to explain how i configured the task : 

simonaubert_1-1668695467766.png

 

Bi Consultant (Dataviz & Dataprep) @ Business & Decision