Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to delete file?

hello guys [:)]

I have a question and I think ( and hope) that it quite simple to done.

I'm loading data from an EXCEL file.

after loading the file I want to delete it from the directory its located,how can I do that from that script?

Is it possible to move it to another directory instead of deleting it?

Do I need to use a batch file? ( I really prefer not to)

10X

David

1 Solution

Accepted Solutions
disqr_rm
Partner - Specialist III
Partner - Specialist III

You can create a VBScript function and then call it from your QlikView script just after the load. See enclosed example.

Make sure to change the file paths and give System access in the Macro to be able to delete the file.

Let me know if it helped by verifying the solution.

View solution in original post

16 Replies
disqr_rm
Partner - Specialist III
Partner - Specialist III

You can create a VBScript function and then call it from your QlikView script just after the load. See enclosed example.

Make sure to change the file paths and give System access in the Macro to be able to delete the file.

Let me know if it helped by verifying the solution.

Karl_Humma
Employee
Employee

The above solution will not work if you are reloading in Publisher, in that case you will need to use a bat file as Pub does not fire off any macros. Just in case you are using Publisher for reloads 🙂

/Karl

Anonymous
Not applicable
Author

It is possible to implement this without macro.
One of my apps reads XML files, and moves them after that into a different folder. Technically not much different from delete. I'm using external batch file for this. This file is called within the reload script by the Execute command.
Just noticed that David doesn't want batch file... Sad

disqr_rm
Partner - Specialist III
Partner - Specialist III

Yes this is another way possible. But then make sure to make a registry adjustment in the server.

See http://community.qlik.com/forums/p/16459/64216.aspx for details.

Not applicable
Author

hi

thanx Rakesh it seem to be working!

Michael,Can you add your solution with the batch file? simultaneously I will check this one

and see if it fits.

Thanx Smile

disqr_rm
Partner - Specialist III
Partner - Specialist III

Here is code line for EXECUTE command prompt commands from script:

Execute cmd /C del /Q "filepath\filename";

Please make sure to make registry adjustments in the server as mentioned in earlier post.

Not applicable
Author

Rakesh, Do I need to build a batch file? if yes,what it contains?

I'm quite new in QV so.....can you please attach an example? Smile

thanx in advance

disqr_rm
Partner - Specialist III
Partner - Specialist III

No, you would put this line in the QVW script just after your load statement:

Execute cmd /C del /Q "filepath\filename";

This line will execute a DOS command "DEL" to delete the file in the quotes with "Q" option for "quietly".

Anonymous
Not applicable
Author



I cannot post my application, and don't have enough time now to create an example, sorry. Here is the description:
I have file move.bat with one line inside, like this:
move Folder1\*.xml folder2\
It moves all xml files from one directory to another. You can use a line here that deletes fiels.
Next, in the QV application script, there is line (after I read the xml data):
EXECUTE move.bat;
The only other things I have to add:
1. Make sure to check "Can Execute External Programs" box on the "Setting" tab of the script editor.
2. On the user preferences, Security - check the box "Script..."
Hope it helps...