Sample Code for File Delete

The sample code below should be entered inside the Edit window's Command mode and not inside the File I/O dialog box.

The following code asks for a file name and then deletes the file.

C1=COMMENT/INPUT,Please type a file you want to delete.

,(Include full file path)

V1=FILE/EXISTS,C1.INPUT

IF/V1<>0

COMMENT/OPER,File exists. Ready to delete.

FILE/DELETE,C1.INPUT

V2=FILE/EXISTS,

IF/V2==0

COMMENT/OPER,File deleted successfully

ROUTINE/END

END_IF/

ELSE/

COMMENT/OPER,File still exists

ROUTINE/END

END_ELSE/

END_IF/

COMMENT/OPER,File doesn't exist to delete. Choose a file that exists.

Code Explanation

Much of this code is similar to that explained in "Sample Code for File Move ".

Only explanations unique to this example are given here.

FILE/DELETE,C1.INPUT
This line deletes the file specified. This command takes one parameter, the name of the file to delete. In this case, C1.INPUT.

Command Mode Commands after Comments

After you insert a PC-DMIS comment, to type additional PC-DMIS commands in Command mode, you must first press Enter twice after the COMMENT command. This tells PC-DMIS that you no longer want to add text to the comment but are ready to add a new command.