well sha256sum has very limited scope of functionality. sha*deep|md5deep have existed for years, moved to the hashdeep package some years ago and have been maintained because. It feels very wrong being directed to this FAQ here as one of the most relevant answers now. This makes me think that actually writing a python code to do the entire thing would have been easier, except for the find command. I initially wanted to write a shell script to do this, but I got bored trying to figure out how to do it, so went back to python. Print("Error: file ", file1_name, " number of lines != ", file2_name, " number of lines") Here is a short python3 code to check the sums line by line, which solves this problem. (Because they are due to the different base directory in the path.) If A/B/C are 1 or more directories containing only 1 subfolder you might end up accidentally running your shasum command in the wrong directory, resulting in the following sort1.txtĮven if sha256sum = sha256sum2 diff will say the files are different. Where * are the subdirectories and files you are interested in shasumming. You may have some path which looks like /A/B/C/* Problem relating to diff output and paths used Without this, if find finds files in a different order, despite the shasums for each file being correct, the overall shasum will depend on the order. The pipe to sort is required to ensure the output is sorted before computing the final sha256sum. Now, if you have many files and do not want to save the output to a file, you could simply shasum the output. type f -exec sha256sum \ | sort > file1.lstĪ complete 1 line command to compare 2 directories with 1 shasum output
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |