DEV Community

Peter + AI
Peter + AI

Posted on

πŸ“ Understanding Uniface's ldirrename Function: Directory Renaming Without Redirections

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
Enter fullscreen mode Exit fullscreen mode

Example:

ldirrename "data/exports", "saved"
Enter fullscreen mode Exit fullscreen mode

πŸ“Š 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)