Liquid UI - Documentation - 7.12 removefile()

7.12 removefile()


Purpose

With removefile(), you can delete unnecessary or duplicate files. The removefile() returns a boolean value based on the removed status of the file when used in a conditional statement.

  • True: If the file is removed
  • False: If the file cannot be removed


Syntax

Format 1: Removes the file from your scripts directory.

removefile("filename");

Format 2: Removes the file from the specified directory.

//You need to specify the file path with double backward slashes between the folder names.
removefile("C:\\LiquidUI\\MMModule\\file.ext");

Note: You need to mention the file path in the command if the file is not present in your scripts folder.

 


Options

The removefile() does not take any options.


Example

In the following example, we will use the removefile() to delete the INC_GET_ORDER_DATA.sjs file from the scripts folder, as shown below:

Note: You can place the above script in any of your screen script files.

 


Script

removefile("INC_GET_ORDER_DATA.sjs");


Tips and Tricks

  • You can delete the content of a file using openfile() with the output option, while the removefile() deletes both the content and the directory entry.

Can't find the answers you're looking for?