Jump to content
Sign in to follow this  
trescon

file comparison

Recommended Posts

trescon

Hi all.

Then I explain my problem, let's see if anyone has any suggestions.

I have files that I prepare every day and load them on a site.

From this site then I PCS (for precision 4) every day download these updated files. sometimes even more 'times a day.

I have the need on to be able to check whether the files that I am downloading now, are the same as those that I downloaded this morning or 1 hour.

Based on what I can to see if the file attualmento can download from the server is the same as I have already ', the date and time I would say no, since it is updated when I upload to the server, I have perhaps entrust to "CRC".

Any suggestions?

Alberto

---------------------------------------------------------------------------------------------------------------------------------

Italian:

Salve a tutti.

Allora vi spiego il mio problema, vediamo se qualcuno ha qualche suggerimento.

Io ho dei file che preparo giorno per giorno e li carico su un sito.

Da questo sito poi ho dei pc (per la precisione sono 4) che ogni giorno scaricano questi file aggiornati. a volte anche piu' volte al giorno.

Io ho la necessitè di poter controllare se i file che sto per scaricare adesso , sono uguali a quelli che ho scaricato stamattina oppure 1 ora fa.

Su cosa mi posso basare per verificare se il file che attualmento posso scaricare dal server è lo stesso che ho gia'; sulla data e l'ora direi di no, visto che viene aggiornata quando faccio l'upload sul server , mi devo forse affidare al "CRC".

Qualche suggerimento ??


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites
water

Do the files have to have a specific format or can you write creation date and time as the first record to the file?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
trescon

Do the files have to have a specific format or can you write creation date and time as the first record to the file?

NO, the files have a specific format that must then be processed by a program in Autoit.

Alberto


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites
water

If there is no attribute of the files (filesize, creation date and time ..) you can use to identify different versions, you then have to check the content of the files.

CRC doesn't help you much as you can't store the calculated CRC.

How big are the files (1 Megabyte, 10, 100?)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
jchd

If your files are on some NTFS volume, you can place the hash of every file as an ADS (alternate data stream) "under" each file. Computing the MD5 (or SHA* or whatever good hash of your choice) is pretty fast and reliable (really much more than a CRC). Comparing ADS containing a hash can be done in a snap.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
trescon

If there is no attribute of the files (filesize, creation date and time ..) you can use to identify different versions, you then have to check the content of the files.

CRC doesn't help you much as you can't store the calculated CRC.

How big are the files (1 Megabyte, 10, 100?)

Some files may be a few Kb some porebbero be 7/8 Mb.

I have 3 higher than 25 Mb.

thanks


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites
trescon

If your files are on some NTFS volume, you can place the hash of every file as an ADS (alternate data stream) "under" each file. Computing the MD5 (or SHA* or whatever good hash of your choice) is pretty fast and reliable (really much more than a CRC). Comparing ADS containing a hash can be done in a snap.

This solution intrigues me but I'm afraid it's bigger than me.

I have not the faintest idea how to do but start

thanks


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites
jchd

We don't make scripts on demand on this forum. Create a basic script doing the core job and use empty functions for computing the hash of the new file and another empty function for comparing to a list of already-known files (this list you have to build). The help file is your best friend.

Then we can help you filling the gory details if you choose this approach.

In the meantime, googling "hash function", "NTFS Alternate Ddata Stream" will shed some light.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
trescon

We don't make scripts on demand on this forum. Create a basic script doing the core job and use empty functions for computing the hash of the new file and another empty function for comparing to a list of already-known files (this list you have to build). The help file is your best friend.

Then we can help you filling the gory details if you choose this approach.

In the meantime, googling "hash function", "NTFS Alternate Ddata Stream" will shed some light.

Ok, I do not want the code done, I would try to figure out how to do that.

That's why I asked for help on how to do that, asking for references where further or examples of "roughly" you can study.

Meanwhile, thanks to the first two suggestions.

Italian :

Ok, io non voglio il codice fatto; vorrei cercare di capire come poterlo fare.

Per questo ho chiesto aiuto sul come poterlo fare , chiedendovi dei riferimenti per dove approfondire, oppure degli esempi "a grandi linee" da poter studiare.

Intanto grazie per i primi due suggerimenti.


Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Share this post


Link to post
Share on other sites
UEZ

Here a fast hack which you can try:

$iRes = FileCompare(@ScriptDir & "\bin1.dat", @ScriptDir & "\bin2.dat")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iRes = ' & $iRes & @crlf) ;### Debug Console

Func FileCompare($sFile1, $sFile2)
    If Not FileExists($sFile1) Then Return SetError(1, 0, 0)
    If Not FileExists($sFile2) Then Return SetError(2, 0, 0)
    If FileGetSize($sFile1) <> FileGetSize($sFile2) Then Return SetError(3, 0, 0)
    Return ((BinaryToString(FileRead($sFile1))) == (BinaryToString(FileRead($sFile2))))
EndFunc

But I agree with jchd to create some kind of hashes to compare each file...

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.