Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Deleting old files

michael_green
Einsteiger
579Aufrufe
I would like to be able to delete all the files in a specified directory that are more than 7 days old. I've been given an example of a VB program that can do this sort of thing but am unable to work out the equivalent in Visual Fortran. Does anyone know how to do this?

With many thanks in advance,

Mike
0 Kudos
1 Antworten
Jugoslav_Dujic
Geschätzter Beitragender II
579Aufrufe

DFLIB:

FINDFILEQQ / GETFILEINFOQQ / DELFILESQQ

Win32:

FindFirstFile / FindNextFile / DeleteFile / FindClose

I believe you'll find some samples on the Forum for the latter (additionally,you'll have to test WIN32_FIND_DATA.ftCreationTime,cast it to an integer(8)and perform 64-bit arithmetics. See also GetLocalTime, SystemTimeToFileTime).
Jugoslav
Antworten