0

I have a directory full of files and subdirectories on a Win7 machine. I want to archive them, so I compress and move them to archival storage. Before compression, I use the CRC context menu to calculate the SHA1 for the full directory, which creates a checksum for the full data and for the directory names. How can I do this on the base directory on *nix after extracting data to compare and ensure data integrity? Or is my understanding of this off? After searching, I have only found ways to check individual files using macOS.

1 Answer 1

0

I think the answer is probably no, as it depends on how CRC context menu arrives at its checksum. Calculating hashes of files is platform agnostic, but at a directory level you would need to be very specific about what data your hashing to make a portal solution. I'm guessing you don't have access to the source code?

I think your easiest option is to use a tar or zip file to create a single file representing your directory structure and files.

If you need to individually compress your files i think your only option is to write a script that can record the hashes and filename of each file, then use that file on the other end to ensure you have all the files, and each file matches its corresponding hash.

2
  • Ah, yes. That is the obvious solution. If I checksum the original data using CRC context menu, compress, checksum the data in the compressed file and compare, I'll know I have an intact compressed dataset (Is this overkill? I just want to make sure the compression didn't alter anything). Then the checksum can be run on the compressed file prior to archival. Upon retrieval however many years later, the compressed file can have a checksum run again to compare. Commented Jan 24, 2019 at 15:32
  • One persons overkill is another persons acceptable risk :) Using a zip/tgz for arching makes a lot of sense. Only downside of using an archive like this you have to download the whole thing to retrieve any part of the content - which in a long term archive probably isn't a big deal? Personally, i would be happy with creating the archive, creating a SHA1 of the archive, then extracting the archive to another folder and comparing the two folder structures. If both copies of the files match you know the SHA1 / contents of the archive is good? Commented Jan 24, 2019 at 17:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .