trescon Posted April 2, 2013 Share Posted April 2, 2013 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. Link to comment Share on other sites More sharing options...
water Posted April 2, 2013 Share Posted April 2, 2013 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
trescon Posted April 2, 2013 Author Share Posted April 2, 2013 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. Link to comment Share on other sites More sharing options...
water Posted April 2, 2013 Share Posted April 2, 2013 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
jchd Posted April 2, 2013 Share Posted April 2, 2013 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 hereRegExp tutorial: enough to get startedPCRE 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) Link to comment Share on other sites More sharing options...
trescon Posted April 2, 2013 Author Share Posted April 2, 2013 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. Link to comment Share on other sites More sharing options...
trescon Posted April 2, 2013 Author Share Posted April 2, 2013 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 startthanks Thank You Alberto --------------------------------------------------- I am translate with Google. Link to comment Share on other sites More sharing options...
jchd Posted April 2, 2013 Share Posted April 2, 2013 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 hereRegExp tutorial: enough to get startedPCRE 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) Link to comment Share on other sites More sharing options...
trescon Posted April 2, 2013 Author Share Posted April 2, 2013 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. Link to comment Share on other sites More sharing options...
UEZ Posted April 2, 2013 Share Posted April 2, 2013 (edited) 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 April 2, 2013 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now