How to check for a file and delete it

Article:HOWTO3087  |  Created: 2006-04-04  |  Updated: 2007-05-17  |  Article URL http://www.symantec.com/docs/HOWTO3087
Article Type
How To



Question
How do I check for a file and delete it, if found?

Answer

Use a Wisescript custom action to either search for a file or use Check if File/Dir exists, then delete file.  Use a Set Variable custom action for the path to the file that should be searched for and also in the Delete File action. 

Check if File/Dir exist then
Delete File
End Statement.

For Example:

Set Variable TEST to C:\TEST
If File or Directory exists %TEST%\File.txt
Delete File(s) %TEST%\File.txt
End Statement

The Check if File/Directory exists action gives you the ability to Display a message only, Start an While loop or Start Block as shown above or abort the installation.


Legacy ID



21556


Article URL http://www.symantec.com/docs/HOWTO3087


Terms of use for this information are found in Legal Notices