Hash

  • We often get duplicate files from the source and therefore it the process fails due to duplicates. I need to have a step in my ETL to check if the incoming file is different from the last one. I think comparing hash is the way to go about it. I have a string column in my sql where i intend to store the last hash value for comparison. However, i feel like i am missing out a lot. Please suggest improvements. Thank You.

    string FilePath;

    byte[] NewFileHashValue;

    FilePath = @"\\\et1\\ftp\\pr\\inbound\\file1.txt";

    HashAlgorithm hash= HashAlgorithm.Create();

    using (FileStream _FileStream= new FileStream (FilePath,FileMode.Open))

    {

    NewFileHashValue = hash.ComputeHash(_FileStream);

    string hashv = Convert.ToBase64String(NewFileHashValue);

    }

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply