Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
swuehl
MVP
MVP

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.

View solution in original post

3 Replies
swuehl
MVP
MVP

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
Author

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?

swuehl
MVP
MVP

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