LUALoriotPro WEB site

LoriotPro scripting documentation
Extensions for LUA language

Table of contents Search function

Print the current page Mail this  link UTUBE Channel version française

lp.GetFileAttrib

LoriotPro has extended the LUA sripting language by providing its own LUA libraries. The new functions provided are dedicated to the creation of monitoring and SNMP automation application.

Syntax

value = lp.GetFileAttrib(‘path/filename’,’Array’);

Description

The lp.GetFileAttrib LUA function collects the attributs of a file

Parameters

‘path/filename’              The file and path to read 

‘Array’                           A table containing all the attributs

Return Values

value                                   A positif value

‘Array'A table containing all the attributs

nil                                       if an error uccors

Array

Description

Array.time_create

The file creationdate

Array.time_access

The last access date

Array.time_write

The last write access date

Array.attrib

The attribut of the file

Array.size

The size of the file

Analyse de la valeur : Array.attrib

Array.attrib

Status du fichier

_A_ARCH

 

0x20

Archive

_A_HIDDEN

 

0x02

hidden

_A_NORMAL

 

0x00

Normal

_A_RDONLY

 

0x01

read only

_A_SUBDIR

 

0x10.

directory

_A_SYSTEM

 

0x04

system file

 

Example

j=lp.FindFile(lp.GetPath(),"*.dll","a");

if j then

       for i=0,(j-1) do

       lp.Print(a[i],"\n");

             k=lp.GetFileAttrib(lp.GetPath().."/"..a[i],"b");

             if k then

             lp.Print(b.time_create," ",b.time_access," ",b.time_write," ",b.attrib," ",b.size,"\n");

             if (lp.AND(b.attrib,0x20)) then

             lp.Print("Normal Archive File\n");

             end

 

             end

       end

   lp_buffer ="good";

end

 

file attrib get lua

 

 

 


www.loriotpro.com