xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

DirRemove()

Removes a directory.

Syntax

DirRemove( <cDirectory> ) --> nOSError

Arguments

<cDirectory>
A character expression specifying the directory to remove. The directory may include a drive letter followed by a colon.

Return

The function returns a numeric value representing the operating system error code (DOS error). A value of 0 indicates a successful operation.

Description

The function attempts to remove the directory specified with <cDirectory>. If this operation fails, the function returns the OS error code indicating the reason for failure. See the FError() function for a description of OS errors.

Info

See also:CurDir(), DirChange(), Directory(), IsDisk(), DiskChange(), DiskName(), MakeDir(), FError()
Category: Directory functions , File functions
Source:rtl\dirdrive.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example creates and deletes directories and outlines possible
// error conditions.

   PROCEDURE Main
      ? CurDrive()+":\"+CurDir()    // result: C:\xhb\tests

      ? MakeDir( "C:\Temp\Data" )   // result: 0

      ? DirRemove( "Data" )         // result: 2

      ? DirRemove( "C:\Temp\data" ) // result: 0

      ? DirRemove( "C:\temp" )      // result: 145
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe