How to email a list of deleted files
Q: I want to email a list of deleted files on a weekly base. Is this possible with Limagito File Mover.
A: You could use our ‘Logging to File’ option but in this case the customer wanted a custom list file so we used our scripting option.
- First you’ll need to setup your delete Rule. We used a Windows Folder as Source:
- Set Function To ‘Delete Files’:
- Open our ‘Rule Events’ option:
Var
tmpList: TStringList;
Const
ctOutputFile = 'C:\Test\FileToSend.txt';
Begin
psExitCode:= 1;
// ... add your code here
tmpList := TStringList.Create;
Try
Try
If FileExists(ctOutputFile) Then
tmpList.LoadFromFile(ctOutputFile)
Else
tmpList.Add('Files deleted since ' + FormatDateTime('d mmmm yyyy', Now));
// Add Info
tmpList.Add(FormatDateTime('YYYY/MM/DD HH:NN:SS', Now) + ' Deleted File: ' + psFilePath + psFileName);
// Save
tmpList.SaveToFile(ctOutputFile)
Except
psLogWrite(1, '', 'Could not adjust file: ' + ctOutputFile);
End;
Finally
tmpList.Free;
End;
End.
- Next add a second Rule which you’ll trigger once a week. Let the second Rule ‘Move’ the create file ‘C:\Test\FileToSend.txt’ (previously defined inthe script of the delete Rule as ctOutputFile) and use SMTP (email) as Destination.
- We would use our schedule option to move this listing file once a week
- The example is set to every Monday at 6:00 AM
If you need any help with this “list of deleted files” question, please let us know.
Best Regards,
Limagito Team
#managedfiletransfer #filetransfer #filemanagement