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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Delete xls files

Hi All.

I have a scenario with multiple xls files to load in QV. After the full load, the end user only want to charge the most recent file and delete the others. Can I automatically remove them since QV? I have already identified the most recent file, I just need to clarify if the rest of the files can be removed directly from QV.

Thanks for your attention.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Not yet, worked ok for me:

EXECUTE cmd.exe /C DEL /P "C:\Temp\test.txt";

View solution in original post

5 Replies
swuehl
MVP
MVP

You can run windows command line commands from within the load script, have a look at EXECUTE in the Help.

The QV script line looks like

Execute cmd.exe /C "D:\YOURPATH\script.bat";


Instead of a batch file, you can call other windows commands, like DEL.


You may need to allow the script to execute in script editor -> settings.

maxgro
MVP
MVP

FOR each _vsFile in 'a.xls', 'b.xls' 

  SET _vsBatch = 'cmd.exe /C del "$(_vsFile)"  /Q';

  trace $(_vsBatch);

  EXECUTE $(_vsBatch);

NEXT;

Not applicable
Author

Thank's for your answers.

I tried using this syntax, but QV execute the cmd.exe instead of script.bat.

In QV:

EXECUTE cmd.exe C/ C:\script.bat;

The script.bat is simple:

DEL /P "C:\Hola Mundo.txt"

Any ideas?

swuehl
MVP
MVP

Not yet, worked ok for me:

EXECUTE cmd.exe /C DEL /P "C:\Temp\test.txt";

Not applicable
Author

Thank's... It's working now.