HB_DirDelete

HB_DirDelete

Attempt to remove a directory

Syntax

      HB_DirDelete( <cDirectory> ) --> nError

Arguments

<cDirectory> The name of the directory to delete

Returns

<nError> 0 if directory was successfully removed, otherwise the number of the last DOS error.

Most probable error codes :

      Code Meaning
      ---- ----------------------------
        2  File ( directory ) not found
      145  Directory not empty

Description

This function attempt to remove the specified directory in <cDirectory>. If this function fails, it will return the last OS error code number. See FERROR() function for the description of the error.

Notes

. This function is file/folder names case sensitive

. <cDirectory> must be empty

. HB_DirDelete()is same as DirRemove() C5.3 function, but it’s always available, not just when HB_COMPAT_C53 is enabled.

Examples

      cDir := ".\backup"
      IF HB_DirDelete( cDir ) == 0
         ? "Remove of directory", cDir, "was successfull"
      ENDIF

Seealso

DirRemove(), MakeDir(), DirChange(), Ferror()

HB_DirCreate

HB_DirCreate

Creates a directory

Syntax

      HB_DirCreate( <cNewDir>) --> <nSuccess>

Arguments

<cNewDir> : the name of the directory to be created, including an optional drive. If you do not specify a drive, the current one is used. The new directory can be specified relative to the current directory, or absolute, including a drive letter followed by a colon.

Return

<nSuccess> : zero on success, -1 if there is an argument error; Otherwise, HB_DirCreate() returns the DOS error code. HB_DirCreate() returns 0 if successful;

Description

HB_DirCreate() creates a specified directory. Note that first you must have sufficient rights to create a directory. To create nested subdirectories, you must create each subdirectory separately, starting from the top-level directory that you want to create (see example below.)

Note

HB_DirCreate() is equivalent to HB_DirBuild(), MakeDir() and DirMake()

Examples

      .  This example assumes that C:\TEST exists and uses HB_DirCreate()
         twice to create a nested subdirectory under it:

      HB_DirCreate("c:\test\one")    // Create top-most one
      nResult := HB_DirCreate("c:\test\one\two")
      IF nResult != 0
         ? "Cannot make directory, DOS error ", nResult
         BREAK
      ENDIF

      You may also use something like this:

      HB_DirCreate( ".\test" )

Seealso

DirChange(), DirName(), DirRemove(), MakeDir(), DirChange()

HB_DirBuild

HB_DirBuild

Creates a directory

Syntax

      HB_DirBuild( <cNewDir>) --> <nSuccess>

Arguments

<cNewDir> : the name of the directory to be created, including an optional drive. If you do not specify a drive, the current one is used. The new directory can be specified relative to the current directory, or absolute, including a drive letter followed by a colon.

Return

<nSuccess> : zero on success, -1 if there is an argument error; Otherwise, HB_DirBuild() returns the DOS error code. HB_DirBuild() returns 0 if successful;

Description

HB_DirBuild() creates a specified directory. Note that first you must have sufficient rights to create a directory. To create nested subdirectories, you must create each subdirectory separately, starting from the top-level directory that you want to create (see example below.)

Note

HB_DirBuild() is equivalent to HB_DirCreate(), MakeDir() and DirMake()

Examples

      .  This example assumes that C:\TEST exists and uses HB_DirBuild()
         twice to create a nested subdirectory under it:

      HB_DirBuild("c:\test\one")    // Create top-most one
      nResult := HB_DirBuild("c:\test\one\two")
      IF nResult != 0
         ? "Cannot make directory, DOS error ", nResult
         BREAK
      ENDIF

      You may also use something like this:

      HB_DirBuild( ".\test" )

Seealso

DirChange(), DirName(), DirRemove(), MakeDir(), DirChange(), HB_DirCreate(), DirMake()

DirMake

DirMake

Creates a directory

Syntax

      DirMake( <cNewDir>) --> <nSuccess>

Arguments

<cNewDir> : the name of the directory to be created, including an optional drive. If you do not specify a drive, the current one is used. The new directory can be specified relative to the current directory, or absolute, including a drive letter followed by a colon.

Return

<nSuccess> : zero on success, -1 if there is an argument error; Otherwise, DirMake() returns the DOS error code. DirMake() returns 0 if successful;

Description

DirMake() creates a specified directory. Note that first you must have sufficient rights to create a directory. To create nested subdirectories, you must create each subdirectory separately, starting from the top-level directory that you want to create (see example below.)

Note

              DirMake() is equivalent to HB_DirCreate(), MakeDir() and HB_DirBuild()

Examples

      .  This example assumes that C:\TEST exists and uses DirMake()
         twice to create a nested subdirectory under it:

      DirMake("c:\test\one")    // Create top-most one
      nResult := DirMake("c:\test\one\two")
      IF nResult != 0
         ? "Cannot make directory, DOS error ", nResult
         BREAK
      ENDIF

      You may also use something like this:

      DirMake( ".\test" )

Seealso

DirChange(), DirName(), DirRemove(), MakeDir(), DirChange(), HB_DirCreate(), HB_DirBuild()

IsDisk()

ISDISK()

Verify if a drive is ready

Syntax

      ISDISK( <cDrive> ) --> lSuccess

Arguments

<cDrive> An valid Drive letter

Returns

<lSuccess> .T. is the drive is ready, otherwise .F.

Description

This function attempts to access a drive. If the access to the drive was successfull, it will return true (.T.), otherwise false(.F.). This function is usefull for backup function, so you can determine if the drive that will receive the backup data is ready or not.

Examples

      IF IsDisk( "A" )
         ? "Drive is ready "
      ENDIF

Tests

      See Examples

Compliance

This function is CA-Cl*pper 5.3 compliant

Platforms

All

Files

Library is rtl

Seealso

DIRCHANGE(), MAKEDIR(), DIRREMOVE(), DISKCHANGE(), DISKNAME()

DirRemove()

DIRREMOVE()

Attempt to remove a directory

Syntax

      DIRREMOVE( <cDirectory> ) --> nError

Arguments

<cDirectory> The name of the directory you want to remove.

Returns

<nError> 0 if directory was successfully removed, otherwise the number of the last error.

Description

This function attempt to remove the specified directory in <cDirectory> If this function fails, it will return the last OS error code number. See FERROR() function for the description of the error.

Examples

      cDir := ".\backup"
      IF DirRemove( cDir ) == 0
         ? "Remove of directory", cDir, "was successfull"
      ENDIF

Tests

      See examples

Compliance

This function is CA-Cl*pper 5.3 compliant

Platforms

All

Files

Library is rtl

Seealso

MAKEDIR(), DIRCHANGE(), ISDISK(), DISKCHANGE(), DISKNAME(), FERROR()

DirChange()

DIRCHANGE()

Changes the directory

Syntax

      DIRCHANGE( <cDirectory> ) --> nError

Arguments

<cDirectory> The name of the directory you want do change into.

Returns

<nError> 0 if directory was successfully changed, otherwise the number of the last error.

Description

This function attempt to change the current directory to the one specified in <cDirectory>. If this function fails, it will return the last OS error code number. See FERROR() function for the description of the error.

Examples

      IF DirChange( "\temp" ) == 0
         ? "Change to diretory was successfull"
      ENDIF

Tests

      See examples

Compliance

This function is CA-Cl*pper 5.3 compliant

Platforms

All

Files

Library is rtl

Seealso

MAKEDIR(), DIRREMOVE(), ISDISK(), DISKCHANGE(), DISKNAME(), FERROR()