Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

timestamp of files listed with fileList()

I am using the DirList/FileList expression to read the filenames from directories.

for each varFile in FileList(varDir&'\*.*')

     Files:

     LOAD

          subfield('$(varFile)','\',-1) as FileName

     AUTOGENERATE (1);

next varFile

Is it possible to get in simple way the creation/change date for the files ?

Thanks for any help !

Christian

1 Solution

Accepted Solutions
MVP
MVP

timestamp of files listed with fileList()

Check out filetime:

filetime( [ filename ] )

Returns a timestamp for the date and time of the last modification of the file filename. If no filename is specified, the function will refer to the currently read table file.

Examples:

filetime( 'xyz.xls' )

Will return the timestamp of the last modification of the file xyz.xls.

Load *, filetime() as X from abc.txt ;

Will return the date and time of the last modification of the file (abc.txt) as a timestamp in field X in each record read.

3 Replies
MVP
MVP

timestamp of files listed with fileList()

Check out filetime:

filetime( [ filename ] )

Returns a timestamp for the date and time of the last modification of the file filename. If no filename is specified, the function will refer to the currently read table file.

Examples:

filetime( 'xyz.xls' )

Will return the timestamp of the last modification of the file xyz.xls.

Load *, filetime() as X from abc.txt ;

Will return the date and time of the last modification of the file (abc.txt) as a timestamp in field X in each record read.

Not applicable

Re: timestamp of files listed with fileList()

Thank you.

Was not aware, that filetime([Ffilename]) works without opening the file in a load statement.

Means:

LOAD

     subfield('$(varFile)','\',-1) as FileName,

      filetime('$(varFile)') as FileTimeStamp

Autogenerate (1) ;

works fine and gives the last change date. Any function known for creation date?

MVP
MVP

Re: timestamp of files listed with fileList()

Any function known for creation date?

Hm, I don't think there is a QV function for that. You could probably try calling system functions e.g. by use of a macro:

http://community.qlik.com/message/3597

Regards,

Stefan

Community Browser