Navigation: Advanced Topics > Clarion Language Utilities >====== RemoveDirectory (Remove a directory) ====== | |
REMOVEDIRECTORY( directoryname )
REMOVEDIRECTORY | Remove an existing directory |
directoryname | A string constant or variable that stores the directory name |
REMOVEDIRECTORY removes an existing directory with the name passed in the directoryname parameter. REMOVEDIRECTORY returns zero (0) if successful, and non-zero if not. You can query the ERRNO built-in library function to trap for the following error codes:
3 ' Path not found (One of the higher path components in directoryname)
5 ' Access Denied (Path may refer to a file, root directory, or current directory)
To add support for this utility to your existing applications, you need only include the CWUTIL.INC file in the Global Map section of your program:
INCLUDE('CWUTIL.INC'),ONCE
Return Data Type: BYTE
Example:
MODULE('')
errno(),*SIGNED,NAME('errno') !proptotype built-in error flag
END
IF REMOVEDIRECTORY(GLO:NewDirectoryName)
CASE Errno()
OF 3
MESSAGE('Path Not Found')
OF 5
MESSAGE('Access Denied')
END
END
See Also: