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

DELETE FILE

DELETE FILE

Remove a file from disk

Syntax

      DELETE FILE <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

      DELETE FILE C:\temp\read.txt

Compliance

Clipper

Seealso

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

CurDir()

 

CURDIR()

Returns the current OS directory name.

Syntax

      CURDIR( [<cDrive>] )  --> cPath

Arguments

<cDrive> OS drive letter

Returns

<cPath> Name of directory

Description

This function yields the name of the current OS directory on a specified drive. If <cDrive> is not specified, the currently logged drive will be used.

This function should not return the leading and trailing (back)slashes.

If an error has been detected by the function, or the current OS directory is the root, the value of the function will be a NULL byte.

Examples

      ? Curdir()

Compliance

Clipper

Platforms

All

Files

Library is rtl

Seealso

FILE()

HB_DiskSpace()

HB_DISKSPACE()

Get the amount of space available on a disk

Syntax

      HB_DISKSPACE( [<cDrive>] [, <nType>] ) --> nDiskbytes

Arguments

<cDrive> The drive letter you are requesting info on. The default is A:

<nType> The type of space being requested. The default is HB_DISK_AVAIL.

Returns

<nDiskBytes> The number of bytes on the requested disk that match the requested type.

Description

By default, this function will return the number of bytes of free space on the current drive that is available to the user requesting the information.

There are 4 types of information available:

HB_FS_AVAIL The amount of space available to the user making the request. This value could be less than HB_FS_FREE if disk quotas are supported by the O/S in use at runtime, and disk quotas are in effect. Otherwise, the value will be equal to that returned for HB_FS_FREE.

HB_FS_FREE The actual amount of free diskspace on the drive.

HB_FS_USED The number of bytes in use on the disk.

HB_FS_TOTAL The total amount of space allocated for the user if disk quotas are in effect, otherwise, the actual size of the drive.

If information is requested on a disk that is not available, a runtime error 2018 will be raised.

Examples

      #include "fileio.ch"
      ? "You can use : " + hb_ntos( hb_DiskSpace() ) + " bytes " +;
        "Out of a total of " + hb_ntos( hb_DiskSpace( "C:", HB_FS_TOTAL ) )

      Note: See tests\tstdspac.prg for another example

Compliance

Harbour

Platforms

DOS, Win, OS2, Unix

Files

Library is rtl Header is fileio.ch

DiskSpace()

DISKSPACE()

Get the amount of space available on a disk

Syntax

      DISKSPACE( [<nDrive>] ) --> nDiskbytes

Arguments

<nDrive> The number of the drive you are requesting info on where 1 = A, 2 = B, etc. For 0 or no parameter, DiskSpace will operate on the current drive. The default is 0

Returns

<nDiskBytes> The number of bytes on the requested disk that match the requested type.

Description

By default, this function will return the number of bytes of free space on the current drive that is available to the user requesting the information.

If information is requested on a disk that is not available, a runtime error 2018 will be raised.

Examples

      ? "You can use : " + hb_ntos( DiskSpace() ) + " bytes "

      Note: See tests\tstdspac.prg for another example

Compliance

Clipper

Platforms

DOS, Win, OS2

Files

Library is rtl Header is fileio.ch