retrieve file creation date

SOLVED

Hello,

I would like to know if it is possible to retrieve file creation date from script.
Example C:\SAFEX3\... or C:\Test\myfile.txt

the goal would be to delete files older than 3 months so that they are not imported by a reccuring task.

Is it possible ? do I need to use a batch file?

Thanks !

Parents
  • +1
    verified answer

    You can make use of the VOLUME class to get the information you need, remember that the area you are the file is located needs to be defined as a "Sage X3 storage area" and/or the is must be defined in the runtime sandbox configuration file. The below will return the date the file created as a datetime value. 

    local Integer XASTATUS
    local Datetime XDATETIME
    local Char XVOLUME
    local Char XFILENAME
    [L]XVOLUME = "TMP" # X3 Storage area name
    [L]XFILENAME = "myfile.txt" # File name + extension

    [L]XASTATUS = Func ASYRSTO.GETFILEDATETIME([L]XVOLUME, [L]XFILENAME, [L]XDATETIME)

Reply
  • +1
    verified answer

    You can make use of the VOLUME class to get the information you need, remember that the area you are the file is located needs to be defined as a "Sage X3 storage area" and/or the is must be defined in the runtime sandbox configuration file. The below will return the date the file created as a datetime value. 

    local Integer XASTATUS
    local Datetime XDATETIME
    local Char XVOLUME
    local Char XFILENAME
    [L]XVOLUME = "TMP" # X3 Storage area name
    [L]XFILENAME = "myfile.txt" # File name + extension

    [L]XASTATUS = Func ASYRSTO.GETFILEDATETIME([L]XVOLUME, [L]XFILENAME, [L]XDATETIME)

Children
No Data