HB_DirUnbuild

HB_DirUnbuild

Attempt to remove a directory

Syntax

      HB_DirUnbuild( <cDir> ) -> <lSuccess>

Argument

<cDir> : The name of the directory to delete

Returns

<lSuccess> : A logical value denotes either <cDir> removed or not

Description

This function attempt to remove the specified directory <cDir> and return .T. if deletion is successfull, else .F.

Note

<cDir> must be empty HB_DirUnbuild() look like a synonym of DirRemove() and HB_DirDelete(); difference is in return value.

Example

      PROC TstDirUnbld()
         LOCAL cDir := 'C:\temp\TstUnB'

         ? 'Is', CDir, 'exists ?    ', HB_DirExists( cDir )   // .T.
         ? 'Is', CDir, 'UnBuilded ? ', HB_DirUnbuild( cDir )  // .F. (*)
         ? 'Is', CDir, 'exists now ?', HB_DirExists( cDir )   // .F.

      RETU // TstDirUnbld()

      (*) observed that <cDir> not found after operation

Seealso

DirRemove(), HB_DirDelete()

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()

DirName

DirName

Returns the current directory name

Syntax

      DirName( [<cDrive>] ) --> <cCurDirName>

Argument

<cDrive> : Designates the drive for which the current directory is determined (a colon is unnecessary). The default is the current drive.

Return

<cCurDirName> : name of the current directory as a character string. The string does not include a drive letter.

Description

DirName() determines the current directory name on the selected drive. You can use this function to construct complete access paths.

Note

DirName() seem as a synonim of CurDir() and doesn’t support <cDrive> properly

Example

      ? '  ->', DirName(), CurDir()              //    -> \temp temp
      ?
      ? DirChange( 'C:\TEMP' )                   //           0
      ? DirChange( 'D:\TEMP' )                   //           0
      ? DirChange( 'E:\TEMP' )                   //           0
      ?
      ? 'C ->', DirName( 'C' ), CurDir( 'C' )    //  C -> \
      ? 'D ->', DirName( 'D' ), CurDir( 'D' )    //  D -> \
      ? 'E ->', DirName( 'E' ), CurDir( 'E' )    //  E -> \
      ?                                          //
      ? 'C:->', DirName( 'C:' ), CurDir( 'C:' )  //  C:-> \
      ? 'D:->', DirName( 'D:' ), CurDir( 'D:' )  //  D:-> \
      ? 'E:->', DirName( 'E:' ), CurDir( 'E:' )  //  E:-> \

Files

lib : hbct

Seealso

CurDir(), DirChange(), DirMake(), DirRemove()

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()

Harbour All Functions – D

Date()
Day()
Days()

DaysInMonth()
DaysToMonth()

dbAppend()
dbClearFilter()
dbCloseAll()
dbCloseArea()
dbCommit()
dbCommitAll()
dbCreate()
dbDelete()
dbEval()
dbF()
dbFilter()
dbGoBottom()
dbGoTo()
dbGoTop()
dbReCall()
dbRLock()
dbRLockList()
dbRUnlock()
dbSeek()
dbSelectArea()
dbSetDriver()
dbSetFilter()
dbSkip()
dbSkipper()
dbStruct()
dbUnlock()
dbUnlockAll()
dbUseArea()

DecToBin()
DecToHexa()
DecToOctal()

Deleted()
Descend()
DevOutPict()
DirChange()
DirRemove()
DiskSpace()

DMY()
Do()
DoW()

DOY
DToC()

DToR
DToS()

MakeDir

MAKEDIR()

Create a new directory

Syntax

      MAKEDIR( <cDirectory> ) --> nError

Arguments

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

Returns

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

Description

This function attempt to create a new directory with the name contained in <cDirectory>. If this function fails, it will return the last OS error code number. See FERROR() function for the description of the error

Note

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

Examples

      cDir := "temp"
      IF MakeDir( cDir ) == 0
         ? "Directory", cDir, "successfully created"
      ENDIF

Tests

      See examples

Compliance

This function is CA-Cl*pper 5.3 compliant

Platforms

All

Files

Library is rtl

Seealso

DIRCHANGE(), DIRREMOVE(), ISDISK(), DISKCHANGE(), DISKNAME(), FERROR(), DirMake(), 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()