Recents
Directory data typeOfficial Content

Directory is a data type that allows the management of system directories. It simplifies the development of applications that need to execute actions over system directories and files.

Use Directory data type for typical operations such as creating, copying, moving, renaming and deleting directories. You can also use the Directory data type to obtain the directory attributes such as modification date, time and size.

Properties

Source Selects the directory in the specified path.
ErrCode Returns the result of the last operation.
ErrDescription Returns the result description of the last operation.

 

... where ErrCode has one of the following values:

 
0 Operation completed successfully
1 Invalid directory instance - when the Source property was not set
2 Directory does not exist
3 Directory already exists
4 Directory not empty
100 Security error
-1 Undefined error

 

Static properties

 

ApplicationDataPath

The directory where files related with the application are stored.

TemporaryFilesPath

The directory where temporary files of the application are stored.

ExternalFilesPath

The path to the external storage device, if it exists, otherwise this property has the value of the property "ApplicationDataPath".

 

For more information about static properties of this data type please refer to Directory Data Type Static properties

 

Methods

Create Creates a new directory in the specified source.
Delete Deletes the specified directory.
Exists Determines whether the specified directory exists.
GetName Returns the name of the specified directory.
GetAbsoluteName Returns the full path name of the specified directory.
Rename Renames the specified directory.
GetFiles Returns the files in the specified directory.
GetDirectories Returns the directories in the specified directory.

 

Create

Creates a new directory.

Parameters

Directory name (character)

Example
&directory.Source="c:\temp"
&directory.create()

Delete

Deletes the directory specified in source.

Example
&directory.delete()

Exists

Checks whether the directory specified in source exists.

Returned values

Boolean

Example
If &directory.exists() 
    Msg("The directory exists!")
Else
    Msg("The directory does not exist!")
EndIf

GetName

Returns the directory of the file specified in source.

Returned values

Character

Example
&directory.Source = "c:\temp"
Msg(&directory.GetName()) // screen shows: temp

GetAbsoluteName

Returns the absolute name of the directory specified in source.

Returned values

Character

Example
&directory.Source="c:\temp"
Msg(&directory.GetAbsoluteName()) // screen shows: c:\temp

Rename

Renames the directory specified in source. It can be also used to move the directory changing its current path.

Parameters

New name of the directory (Character).

Example
&directory.Rename("d:\temp2")

GetFiles

Returns the names of files in the specified directory.

Parameters

Filter (Character)

Example
// Java:
for &auxFile in &directory.GetFiles('txt')
   // do something
endfor

// .NET
for &auxFile in &directory.GetFiles('*.txt')
   // do something                
endfor

...where &auxFile is defined as a File variable.

GetDirectories

Returns the names of directories in the specified directory.

Example
for &auxDir in &directory.GetDirectories()
  //do something
endfor

...where &auxDir is defined as a Directory variable.

Restrictions

   Mapped Drives and Network Drives are not supported in web environments

Scope

Languages .NET, Java, Ruby, Android Smart DevicesApple Smart Devices (iOS)
Objects Procedure object, Web Panel object, Transaction objectSmart Devices objects



Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.