How to verify that the checksum of destination files remain unchanged
Q: Is it possible to verify that a file’s encryption (SHA) in the source folder remains unchanged when it is transferred to the destination folder? Additionally, send an email if anything has changed.
We want to know when a change is made to the file after it has been moved to the destination folder. Additionally, get an email notification if there is a change. Another software should pull the file, we ask to check that no changes were made to the file until it transferred from the destination folder .
A: We needed two Rules to achieve this.
- Rule 1: Will search for the Source files to move. When a file is found, it will add some information (filename, checksum, date) about this file to a separate data text file.
- Rule 2: Will check the Destination folder of the first Rule. It will search for moved files and if a file is found (not yet picked up), it will compare its checksum with the information found in the data text file. If there is a difference, Rule 2 will return an error which will trigger an email event.
![limagito file mover checksum of destination files](https://limagito.com/wp-content/uploads/checksum-of-destination-files.02.png)
1. First Rule: ‘OPC Move’
Source must be a Windows folder or share:
![limagito file mover windows folder as source](https://limagito.com/wp-content/uploads/merge-and-add-filenames.01.png)
Function Setup, we enabled ‘Exit Cyclus on Error’ as Destination option:
![limagito file mover function setup](https://limagito.com/wp-content/uploads/checksum-of-destination-files.04.png)
Destination Setup, we added two Destinations:
- Pascal Script as Destination
- WIN (Windows Folder or Share) as Destination
![limagito file mover destination setup](https://limagito.com/wp-content/uploads/checksum-of-destination-files.03.png)
First Destination: Pascal Script:
Do not forget to adjust the ctChecksumFile const. This is the data file where we keep checksum information about the files we moved.
Important:
- The path of this file should already exist, we’ll create the file.
- This path should be a local path on the system where Limagito File Mover is running.
- It should NOT be the same as the Source or Destination Path, use a folder that is only used for this purpose.
You can download the script: here
![limagito file mover pascal script as destination](https://limagito.com/wp-content/uploads/checksum-of-destination-files.05.png)
Second Destination, is the actual Destination folder of the Source files. This is where the other software will pull the files from. Destination must be a Windows folder or share.
![limagito file mover windows folder as destination](https://limagito.com/wp-content/uploads/checksum-of-destination-files.06.png)
2. Second Rule: ‘OPC Checksum Check’
The Source of this second Rule is the Destination of the First ‘Move’ Rule, this is important. This Second Rule will search for moved files and if a file is found (not yet picked up), it will compare its checksum with the information found in the data text file. If there is a difference, Rule 2 will return an error which will trigger an email event.
![limagito file mover Windows folder as destination](https://limagito.com/wp-content/uploads/checksum-of-destination-files.07.png)
As Schedule we used a timer and set it to every 5 seconds:
![limagito file mover schedule setup](https://limagito.com/wp-content/uploads/checksum-of-destination-files.08.png)
Function Setup: set ‘Rule Function’ to copy. We will not copy any files but this needed by the internal process.
![limagito file mover function setup](https://limagito.com/wp-content/uploads/checksum-of-destination-files.11.png)
As Destination, we added a ‘Pascal Script’. This script will compare the checksum of the files found with the information in the data text file. If there is a difference it will return an error which will trigger an email event.
![limagito filemover destination setup](https://limagito.com/wp-content/uploads/checksum-of-destination-files.09.png)
Destination: Pascal Script:
Do not forget to adjust the ctChecksumFile const. This is the data file where checksum information about the moved files by the first ‘Move’ Rule is kept.
Important: Use exactly the same file as you did in the Pascal Script of the first ‘Move’ Rule.
You can download the script: here
![limagito file mover checksum of destination files](https://limagito.com/wp-content/uploads/checksum-of-destination-files.10.png)
Open our Rule events option:
![limagito file mover rule events option](https://limagito.com/wp-content/uploads/checksum-of-destination-files.12.png)
![limagito filemover rule events setup](https://limagito.com/wp-content/uploads/checksum-of-destination-files.13.png)
With ‘On Error’ selected > Options Tab > Enable ‘File Error event memory’. This way you only get one email per filename.
![limagito file mover rule events setup](https://limagito.com/wp-content/uploads/checksum-of-destination-files.14.png)
Email Setup:
![limagito file mover rule events email setup](https://limagito.com/wp-content/uploads/checksum-of-destination-files.16.png)
RunTime Log Result:
![limagito file mover runtime log result](https://limagito.com/wp-content/uploads/checksum-of-destination-files.15.png)
#managedfiletransfer #filetransfer #filemanagement
If you need any help with this ‘checksum of destination files’ request, please let us know.
Best Regards,
Limagito Team