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

HB_CurDrive

HB_CurDrive

Return the current OS drive

Syntax

      HB_CurDrive() --> cDrive
     

Returns

HB_CurDrive() returns the letter of the current DOS drive, without a trailing colon.

Examples

      ? HB_CurDrive()        // D
      ? DiskChange()      // .F.
      ? DiskChange( "C" ) // .T.
      ? HB_CurDrive()        // C
      
      .  This example illustrates the relationship between
         HB_CurDrive()and DISKCHANGE() and shows that HB_CurDrive() is unaffected by
         the SET DEFAULT TO command:
      
      ? HB_CurDrive()      // C
      SET DEFAULT TO A
      ? HB_CurDrive()      // C
      DISKCHANGE("A")
      ? HB_CurDrive()      // A
      DISKCHANGE("C")
      ? HB_CurDrive()      // C
     

Seealso

CurDir(), DiskChange(), DiskName()

HB_FNameSplit

HB_FNameSplit()

Splits a full file specification into individual components.

Syntax

      HB_FNameSplit( <cString>      , ;
                     [@<cPath>]     , ;
                     [@<cFileName>] , ;
                     [@<cExtension>]  ) --> NIL

Arguments

<cString> : a character string to split into different components of a file name.

@<cPath> : If specified, <cPath> must be passed by reference. It receives the path component for a file as a character string.

@<cFileName> : If specified, <cFileName> must be passed by reference. It receives the name component for a file as a character string.

@<cExtension> : If specified, <cExtension> must be passed by reference. It receives the file extension as a character string.

Return

This function returns always NIL. The components of a file name are assigned to the parameters passed by reference.

Description

HB_FNameSplit() is used to split a full qualified file name into individual components. They can be merged later with function HB_FNameMerge().

Seealso

CurDir(), CurDrive(), Directory(), File(), HB_FNameMerge()

HB_FNameMerge

HB_FNameMerge()

Composes a full file specification from individual components

Syntax

      HB_FNameMerge( [<cPath>]     , ;
                     [<cFileName>] , ;
                     [<cExtension>]  ) --> cResult

Arguments

<cPath> : a character string holding the path component for a file.

<cFileName> : a character string holding the name component for the file.

<Extension> : a character string holding the file extension.

Return

This function returns a character string containing all components passed to the function. When no parameter is passed, an empty string (“”) is returned.

Description

HB_FNameMerge() is used to build a full qualified file name from individual components. They can be obtained by calling HB_FNameSplit().

Seealso

CurDir(), CurDrive(), Directory(), File(), HB_FNameSplit()

DiskName

DiskName

Return the current OS drive

Syntax

      DiskName() --> cDrive

Returns

DiskName() returns the letter of the current DOS drive, without a trailing colon.

Examples

      ? DiskName()        // D
      ? DiskChange()      // .F.
      ? DiskChange( "C" ) // .T.
      ? DiskName()        // C

      .  This example illustrates the relationship between
         DiskName()and DISKCHANGE() and shows that DiskName() is unaffected by
         the SET DEFAULT TO command:

      ? DiskName()      // C
      SET DEFAULT TO A
      ? DiskName()      // C
      DISKCHANGE("A")
      ? DiskName()      // A
      DISKCHANGE("C")
      ? DiskName()      // C

Seealso

CurDir(), DiskChange()

Harbour All Functions – C

CD / CHDIR / DirChange

CDoW

Chr

CharAdd
CharAnd
CharEven
CharHist
CharList
CharMirr
CharMix
CharNoList
CharNot
CharOdd
CharOne
CharOnly
CharOr
CharPix
CharRela
CharRelRep
CharRem
CharRepl
CharRLL
CharRLR
CharSHL
CharSHR
CharSList
CharSort
CharSub
CharSwap
CharWin
CharXOR

CLIPINIT
CMonth

Col

Cos

CosH

CountLeft
CountRight

CToBit

CToD

CToDoW
CToF
CToMonth
CToN

CurDir

CSetArgErr
CSetAtMuPa
CSetRef
CTCExit
CTCInit
CTExit
CTInit

SET PATH

SET PATH

Specifies a search path for opening files

Syntax

      SET PATH TO [<cPath>]

Arguments

<cPath> Search path for files

Description

This command specifies the search path for files required by most commands and functions not found in the current drive and directory. This pertains primarily, but not exclusively, to databases, indexes, and memo files, as well as to memory, labels and reports files. The search hierarchy is: 1 Current drive and directory, 2 The SET DEFAULT path; 3 The SET PATH path.

Examples

      SET PATH TO C:\harbour\test

Compliance

Clipper

Seealso

SET DEFAULT, CurDir(), Set()

SET DEFAULT

SET DEFAULT

Establishes the Harbour search drive and directory.

Syntax

      SET DEFAULT TO [<cPath>]

Arguments

<cPath> Drive and/or path.

Description

This command changes the drive and directory used for reading and writing database, index, memory, and alternate files. Specifying no parameters with this command will default the operation to the current logged drive and directory.

Examples

      SET DEFAULT TO C:\temp

Compliance

Clipper

Seealso

SET PATH, CurDir(), Set()

RENAME

RENAME

Changes the name of a specified file

Syntax

      RENAME <cOldFile> TO <cNewFile>

Arguments

<cOldFile> Old filename

<cNewFile> New Filename

Description

This command changes the name of <cOldFile> to <cNewFile>. Both <cOldFile> and <cNewFile> must include a file extension. This command if not affected by the SET PATH TO or SET DEFAULT TO commands; drive and directory designates must be specified if either file is in a directory other then the default drive and directory.

If <cNewFile> id currently open or if it previously exists, this command will not perform the desired operation.

Examples

      RENAME hello.txt TO hello.old

Compliance

Clipper

Files

Library is rtl

Seealso

CURDIR(), ERASE, FILE(), FERASE(), FRENAME()

ERASE

ERASE

Remove a file from disk

Syntax

      ERASE <xcFile>

Arguments

<xcFile> Name of file to remove

Description

This command removes a file from the disk. The use of a drive, directo- ry, and wild-card skeleton operator is allowed for the root of the filename. The file extension is required. The SET DEFAULT and SET PATH commands do not affect this command.

The file must be considered closed by the operating system before it may be deleted.

Examples

      ERASE C:\temp\read.txt

Compliance

Clipper

Seealso

CURDIR(), FILE(), FERASE(), DELETE FILE