Printing md5sum find command results in Linux

I am trying to perform a checksum for all .jar files that I can find in a directory and its subdirectories. Then print the file name using the checksum value in the file.

this is what i have.

md5sum | find -name *.jar >result.txt 

I am trying to combine two teams that, as I know, work individually.

Any help was appreciated.

+4
source share
2 answers

You can use something like this to execute a command for each file:

 find . -name "*.jar" -exec md5sum {} \; >result 
+8
source

This will also work for a recursive hash of all files in the current directory or subdirectories (thanks to my sysadmin!):

 md5sum $(find . -name '*.jar') > result.txt 

The above will mean "./" for the file name (without including the path).

Using the -exec clause from mux adds “*” to the file name (again, without a path).

The specified order of the files also differed between them, but I can not guarantee to say exactly why, since I am a complete noob for bash scripts.

Edit: Forget about the above with respect to the preliminary and complete path, which was based on my experience running remotely at HPC. I just ran the sysadmin sentence in my local windows window using cygwin and got the full path by adding "*. /". I need to use some other fiction to flush the inconsistent path and append to simplify the comparison. In short, YMMV.

+1
source

All Articles