Question

I want to copy files from folderA to folderB, where some of the copied files are written over existing files in folderB. folderB also contains files, which are not in folderA. After the operation I want to compare the md5sum of all the copied files in folders A and B.

How can I produce a list of files in folderA and pipe it to md5sum in folderB? I tried:

 ls -1 | md5sum

but 'ls -1' is not a list of different files for md5sum...

Many thanks

Was it helpful?

Solution

I guess you want to generate the md5sum of the files in folderA and the equivalent files in folderB:

cd folderA
md5sum *
cd folderB
( cd folderA && ls ) | xargs md5sum

However you might want to look at diff instead to check. And maybe rsync for doing the copying.

OTHER TIPS

It should be reversely: ls | md5sum.

But that will compare only the file names. Is that what you really want?

If you want sums of all the contents of all the files, do for example cat * | md5sum.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top