Trash Method (RUNTIME)


 

The Trash method allows a directory or file to be deleted and moved to the Windows Recycle Bin. This method is only implemented for the Windows. The method uses the following format:

 

[label]

{object}.Trash

[GIVING {return}] USING [*Path=]{path}[:

 

 

[*FileName=]{filename}

 

 

[*Options=]{options}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A RUNTIME object.

return

Optional. A Numeric Variable that returns any error number generated.

path

Required. A Character String Variable or literal that contains the Windows directory. The path must be a valid Windows directory and wildcard characters are not allowed in the path string.

filename

Optional. A Character String Variable or literal that contains an optional filename. If a filename is specified, Windows wildcard characters are allowed.

options

Optional. A Numeric variable or decimal number that invokes special behaviors for the method.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. The EOS flag is always cleared.

  2. The ZERO flag is set TRUE if the {return} value is zero. Otherwise, the ZERO flag is set to FALSE.

  3. The OVER flag is set if the {return} variable is too small to receive the value without being truncated.

  4. The path parameter is always required. If the filename parameter is not specified or is NULL, the Trash method deletes the specified directory which is moved to the Windows recycle bin. The path parameter must be an existing directory and no Windows wildcard characters are allowed. Otherwise, the method gives an error.

  5. The {options} parameter is available for future use.

  6. If the {path} drive being used refers to a SUBST'd drive or a network shared drive, this method does not move a deleted file/directory to the Windows recycle bin. This behavior is controlled by the Windows operations.

  7. If the Trash method fails, the returned error values are described as follows:

  8.  

    Value

    Description

    -1

    The path does not exist.

    -2

    The wildcard characters ( * and ? ) are not allowed.

    nnn

    The 'nnnn' error values are the Windows Error code values except described as follows:

    116 (0x74) The source is a root directory, which cannot be moved or renamed.

     

    120 (0x78) Security settings denied access to the source.

     

    121 (0x79 ) The source or destination path exceeded or would exceed MAX_PATH.

 

 

See Also: RUNTIME, Method Syntax

 



PL/B Language Reference