How to remove old files from directory (Selected by date)

Options
Hello evreybody,

I'd like to remove the fold files (Older than 1 year) I created with the following code :

                            

            VAR string stFilePath:="Home:/BackupLogs/";
            VAR string stFileName;
            VAR iodev logfile;
            VAR string stPart;

            stFileName:=stFilePath+stDate+"_MyFile.csv";

            Open stFileName, logfile\Append;
            Write logfile,stTimeLogs;
            Close logfile;

How could I filter and remove the files containing the stPart in the name ?

            stPart := StrPart(stDate,1,4);
            RemoveFile(stFilePath+"/"+FileName);


Thanks for your help










Regards

Cornet Raymond
Manager
+352 621 354 570
raymond.cornet@luxrobotic.com
http://www.luxrobotic.com

HP ZBook Fury 16 G11