DateCreated Property

Applies to TestComplete 15.68, last modified on October 16, 2024

Description

Use the DateCreated property to learn when the given folder was created.

Declaration

aqFolderInfoObj.DateCreated

Read-Only Property Date/Time
aqFolderInfoObj An expression, variable or parameter that specifies a reference to an aqFolderInfo object

Applies To

The property is applied to the following object:

Property Value

A Date object that contains the folder's creation date.

Example

The code below creates a folder, adds a file to it and then counts the number of the files located in the folder. After that, it posts the time when the folder was created, last modified and last accessed to the test log and deletes the folder.

JavaScript, JScript

function GetTimeExample()
{
 var sPath = "C:\\Temp";

 // Creates a folder
 aqFileSystem.CreateFolder(sPath);
 
 var FolderInf = aqFileSystem.GetFolderInfo(sPath);

 // Delays the script execution
 Delay(2000);
 
 // Adds a file to the folder
 aqFile.Create(sPath + "\\TempFile.txt");
 
 // Delays the script execution
 Delay(2000);
 
 // Obtains the number of files located in the C:\Temp folder
 Num = FolderInf.Files.Count;
 
 // Posts the time when the folder was created to the test log
 Log.Message( FolderInf.DateCreated );
 // Posts the folder's last write time to the test log
 Log.Message( FolderInf.DateLastModified );
 // Posts the folder's last access time to the test log
 Log.Message( FolderInf.DateLastAccessed );
 
 // Deletes the folder
 FolderInf.Delete(true);
}

Python

def GetTimeExample():
  sPath = "C:\\Temp"
  # Creates a folder
  aqFileSystem.CreateFolder(sPath)
  FolderInf = aqFileSystem.GetFolderInfo(sPath)
  # Delays the script execution
  Delay(2000)
  # Adds a file to the folder
  aqFile.Create(sPath + "\\TempFile.txt")
  # Delays the script execution
  Delay(2000)
  # Obtains the number of files located in the C:\Temp folder
  Num = FolderInf.Files.Count
  # Posts the time when the folder was created to the test log
  Log.Message(FolderInf.DateCreated)
  # Posts the folder's last write time to the test log
  Log.Message(FolderInf.DateLastModified)
  # Posts the folder's last access time to the test log
  Log.Message(FolderInf.DateLastAccessed)
  # Deletes the folder
  FolderInf.Delete(True)

VBScript

Sub GetTimeExample

 sPath = "C:\Temp"
 
 ' Creates a folder
 aqFileSystem.CreateFolder(sPath)
 
 Set FolderInf = aqFileSystem.GetFolderInfo(sPath)
 
 ' Delays the script execution
 Delay(2000)
 
 ' Adds a file to the folder
 aqFile.Create(sPath & "\TempFile.txt")
 
 ' Delays the script execution
 Delay(2000)
 
 ' Obtains the number of files located in the C:\Temp folder
 var Num = aqFileSystem.GetFolderInfo(sPath).Files.Count
 
 ' Posts the time when the folder was created to the test log
 Log.Message( FolderInf.DateCreated )
 ' Posts the folder's last write time to the test log
 Log.Message( FolderInf.DateLastModified )
 ' Posts the folder's last access time to the test log
 Log.Message( FolderInf.DateLastAccessed )
 
 ' Deletes the folder
 FolderInf.Delete(true)
 
End Sub

DelphiScript

function GetTimeExample;
var sPath, FolderInf, Num;
begin

 sPath := 'C:\Temp';

 // Creates a folder
 aqFileSystem.CreateFolder(sPath);
 
 FolderInf := aqFileSystem.GetFolderInfo(sPath);

 // Delays the script execution
 Delay(2000);
 
 // Adds a file to the folder
 aqFile.Create(sPath + '\TempFile.txt');
 
 // Delays the script execution
 Delay(2000);
 
 // Obtains the number of files located in the C:\Temp folder
 Num := FolderInf.Files.Count;
 
 // Posts the time when the folder was created to the test log
 Log.Message( FolderInf.DateCreated );
 // Posts the folder's last write time to the test log
 Log.Message( FolderInf.DateLastModified );
 // Posts the folder's last access time to the test log
 Log.Message( FolderInf.DateLastAccessed );
 
 // Deletes the folder
 FolderInf.Delete(true);
end;

C++Script, C#Script

function GetTimeExample()
{
 var sPath = "C:\\Temp";
 
 // Creates a folder
 aqFileSystem["CreateFolder"](sPath);
 
 var FolderInf = aqFileSystem["GetFolderInfo"](sPath);

 // Delays the script execution
 Delay(2000);
 
 // Adds a file to the folder
 aqFile["Create"](sPath + "\\TempFile.txt");
 
 // Delays the script execution
 Delay(2000);
 
 // Obtains the number of files located in the C:\Temp folder
 Num = FolderInf["Files"]["Count"];
 
 // Posts the time when the folder was created to the test log
 Log["Message"]( FolderInf["DateCreated"] );
 // Posts the folder's last write time to the test log
 Log["Message"]( FolderInf["DateLastModified"] );
 // Posts the folder's last access time to the test log
 Log["Message"]( FolderInf["DateLastAccessed"] );
 
 // Deletes the folder
 FolderInf["Delete"](true);
}

See Also

Working With Files From Scripts
GetFolderInfo Method
DateLastAccessed Property
DateLastModified Property

Highlight search results