Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Forgot to explain how i configured the task :