As a Uniface developer, you might encounter situations where you need to rename directories programmatically while bypassing file redirections. This is where the ldirrename
statement comes in handy! π
Note: This article is based on the Uniface documentation 10.4, and I had assistance from AI in creating this content.
π§ What is ldirrename?
The ldirrename
statement is a powerful Uniface function that renames directories while ignoring any file redirections defined in the assignment file. Think of it as a "direct" rename operation that bypasses the usual redirection logic.
π Syntax & Usage
The syntax is straightforward:
ldirrename DirPath, NewDirName
Example:
ldirrename "data/exports", "saved"
π Parameters Breakdown
Parameter | Data Type | Description |
---|---|---|
DirPath |
String | Directory name with optional path. Can be in a zip archive! π¦ |
NewDirName |
String | New directory name (no path, no trailing separator). Can also be in zip archives! |
β‘ Return Values & Error Handling
The function returns values via $procerror
:
- 0 - Success! β
- -13 (
UIOSERR_OS_COMMAND
) - OS command error β
Pro tip: Set /pri=64
to display detailed error messages in the message frame when troubleshooting! π
π― Key Features
- Ignores redirections: Unlike
dirrename
, this bypasses assignment file redirections - Zip archive support: Works with directories inside zip files
- Universal compatibility: Allowed in all component types
- Flexible paths: Supports both relative and absolute paths
π‘ When to Use ldirrename
Use ldirrename
when you:
- Need to rename directories without triggering file redirections
- Work with zip archives containing directories
- Want direct control over directory operations
- Need consistent behavior across different deployment environments
π Related Functions
For comparison, check out the standard dirrename
function if you need redirection-aware directory renaming.
Happy coding with Uniface! π
Top comments (0)