For the complete documentation index, see llms.txt. This page is also available as Markdown.

FileDelete

Deletes the specified file on the server.

Throws an exception if the file doesn't exist.

Method Signature

FileDelete(file=[boxfile])

Arguments

Argument
Type
Required
Description
Default

file

boxfile

true

The file to delete.

Examples

Script Syntax

Obtaining files within an archive folder and then removing them if they are older than one hour.

var existingFiles = directoryList( expandPath( "/archive/" ), false, "query" );
for( file in existingFiles ) {
	if( dateDiff( "h", file.DATELASTMODIFIED, now() ) > 1 ) {
		fileDelete( file.DIRECTORY & "\" & file.NAME );
	}
}

Result: All files within the archive directory older than one hour will be deleted.

Additional Examples

Last updated

Was this helpful?