Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hola
Estoy usando un archivo de base de datos en Excel wich se genera en varias ocasiones durante el día. Tengo que cargar la fecha del archivo cuando fue creado o modificado con el fin de conocer el último informe cargado en QV
Muchas gracias
Have a look at
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.
Have a look at
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.
Hola,
here you have the code snippet for looping through a directory for files and get the desired File information:
Let RootDirectory = Left(DocumentPath(), (index(DocumentPath(), '\', -1)-1));
Let CountChars = SubStringCount(RootDirectory,'\')+3;
sub BrowseDir(Root,n)
for each FileExtension in 'pdf'
for each FoundFile in filelist( Root & '\Documentos\*.' & FileExtension)
let FoundFile = PurgeChar(FoundFile , Chr(39));
FileList:
Load *,
num(FileSize(Filepath),'# ### ### ###',',',' ') as FileSize,
FileTime(Filepath) as FileTime;
load '$(FoundFile)' as Filepath,
subfield('$(FoundFile)','\',$(n)) as Filename,
left(subfield('$(FoundFile)','\',$(n)), 4) as ClientNumber,
mid(subfield('$(FoundFile)','\',$(n)), 6, 2) as DocLanguage
Autogenerate(1);
next FoundFile
next FileExtension
end sub
call BrowseDir(RootDirectory,CountChars);
Dates:
Load
FileTime,
Year(FileTime) as Year,
Month(FileTime) as Month,
Day(FileTime) as Day,
Num(Round(now() - FileTime),'####') as 'Age(days)'
resident FileList;
Cheers,
Patric
Hello swuehl.
Thanks a lot. It works just what I wanted it
Regards
Hello Patric
I'm not so clever using large scripts and I could not achieve to work as I need . Anyway, I appreciate your answer
Regards
Looks like you got what you wanted.
Please mark the correct answer as correct, that way the topic will be closed.