FileDelete

FileDelete

Deletes file(s) by name and attribute

Syntax

      FileDelete(<cFileMask>, [<nFileAttr>]) --> <lDeleted>

Arguments

<cFileMask> : Designates the file or files to delete.

<nFileAttr> : Designates one of the following file attributes. The default value is 32.

          File Attribute Coding
          ---------------------------------------------------------------
          Value     Symb. constants   Definition
          ---------------------------------------------------------------
          0         FA_NORMAL
          1         FA_READONLY       Read-only
          2         FA_HIDDEN         HIDDEN (Concealed files)
          4         FA_SYSTEM         SYSTEM (System files)
          8         FA_VOLUME         VOLUME (Name of floppy/hard disk)
          32        FA_ARCHIVE        ARCHIVE (Changed since last backup)
          63        Everything
          ---------------------------------------------------------------

Returns

<lDeleted> .T. when at least one or more files are deleted; otherwise, .F. is returned.

Description

ERASE command and FErase() function doesn’t support “wildcard” ( “*” / “?” ) characters in file specification. FileDelete() function of tools library does. Occasionally, you will need to clean up a floppy or a hard disk or delete whole file groups. This function deletes entire file groups with a function call, without using the RUN command.

Notes

Warning! FileDelete() can also can delete system files.

. The default standard attribute is archive (32). Drive and path designations, and wildcards are permitted.

. Subdirectories must be deleted with the help of the DirRemove() function.

Example

      Attempt to delete all index files, then display the completion status:

      IF FileDelete("*.NDX")
         ? "Files deleted."
      ELSE
         ? "No files found."
      ENDIF

Seealso

DeleteFile()

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s