This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v19.8
folder.delete( )

folder.delete( ) 


 

folder.delete ( {option} ) 
Parameter Type   Description
option  Longint in Folder deletion option

The folder.delete( ) method deletes the folder. 

By default, for security reasons, if you omit the option parameter, folder.delete( ) only allows empty folders to be deleted. If you want the command to be able to delete folders that are not empty, you must use the option parameter with one of the following constants:

Constant Value Comment
Delete only if empty 0 Deletes folder only when it is empty
Delete with contents 1 Deletes folder along with everything it contains

When Delete only if empty is passed or if you omit the option parameter:

  • The folder is only deleted if it is empty; otherwise, the command does nothing and an error -47 is generated.
  • If the folder does not exist, the error -120 is generated.

When Delete with contents is passed:

  • The folder, along with all of its contents, is deleted.
    Warning: Even when this folder and/or its contents are locked or set to read-only, if the current user has suitable access rights, the folder (and contents) is still deleted.
  • If this folder, or any of the files it contains, cannot be deleted, deletion is aborted as soon as the first inaccessible element is detected, and an error(*) is returned. In this case, the folder may be only partially deleted. When deletion is aborted, you can use the GET LAST ERROR STACK command to retrieve the name and path of the offending file.
  • If the folder does not exist, the command does nothing and no error is returned.
    (*) Windows: -54 (Attempt to open locked file for writing)
    macOS: -45 (The file is locked or the pathname is not correct)



See also 

DELETE DOCUMENT
DELETE FOLDER

 
PROPERTIES 

Product: 4D
Theme: File and Folder

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17 R5

 
ARTICLE USAGE

4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)