Article ID: 10100
SAMPLE: Deleting a File on the PC using 'Data Processing Scripts'
SAMPLE
Applies To: ITScriptNet V1/V2

This sample shows how to delete a file on the PC during the Downlaod Process. Specificly, the samle shows how to delete the output file (defined in Configure recieve screen) after the collected data has been processed. Code to accomplish this task must be written in VBScript because it executes in the Data Processing Scripts which only interpret VBScript Language.

This functionality can be used to help maintain the contents of directories on the PC (removing old files which are no longer needed).

DETAILS

Place the following code in the 'After Processing Data' script of the Data Processing scripts (Program->Configure Receive->Edit Scripts...).
'CREATE FILE SYSTEM OBJECT
Set oFSO = CreateObject("Scripting.FileSystemObject")

'GET CURRENT FOLDER
Set oFolder = oFSO.GetFolder(".")

'GET THE PATH OF THE CURRENT FOLDER
sDir = oFSO.GetAbsolutePathName(oFolder)

'GET FILE TO DELETE
Set oFile = oFSO.GetFile(sDir & "\Data.txt")

'DELETE FILE oFile.Delete

'CLEAN UP OBJECTS
Set oFile = Nothing
Set oFolder = Nothing
Set oFSO = Nothing

This Script uses VBScript's File System Object to accomplish the following tasks:
  • Gets the Current Folder
  • Gets the FULL Path of the Current Folder
  • Deletes the original specified output file after it downloading data to it.

This article last updated: 1/1/2009 12:00:00 AM
Please help us improve the Knowledge Base by rating this article.
    © 1997-2026 Z-Space Technologies - a BCA Innovations Company - All rights reserved