Hash file to check if a backup needs to be sent #49
Replies: 1 comment
-
I am sorry! Forget about it. The same files obviously do not have the same hash. Probably some date time in the backup / script :-( PS C:\Scripts> $files
Mode LastWriteTime Length Name -a---- 03.01.2024 12:50 481095 v7.13_stable_2024-01-03-12-50-35.backup PS C:\Scripts> $hashes = $files | ForEach-Object -Process {Get-FileHash -Path $_.FullName -Algorithm MD5} Algorithm Hash Path MD5 C1A35542555D9E0B843C6F5816E88EF2 S:\v7.13_stable_2024-01-03-12... |
Beta Was this translation helpful? Give feedback.
-
Hello,
I have an idea that would add another function to the already perfect script.
If you were to perform, for example, an MD5 hash of files (https://forum.mikrotik.com/viewtopic.php?f=9&t=62895&hilit=md5 ), then it would be possible to clearly determine whether the file in the destination already exists or not. So files could only be uploaded if the configuration has changed.
If you had the MD5 of the file and added it to the file name, it would be possible to work with it during the check.
Create a backup and RSC make it MD5 and [If exist on FTP/HTTP filename like MD5] then send an email that there is no need to send another backup.
Of course, it can be built with increased certainty that the entire previous backup is downloaded from FTP and the MD5 is also calculated from the downloaded file. This would guarantee not only that a file with the same hash exists, but that it really is the same.
It would be possible to add a TXT file with the date and time to the FTP, so that there is information that the backup took place, but there was no need to create another backup file and RSC. Of course, in this case it would be better to create a TXT and an XML file in which lines would be added.
Just an idea ;-)
Beta Was this translation helpful? Give feedback.
All reactions