I want to list (and save) Md5 check sum of all the files in a directory and save that list in a text file called md5sum.txt
it would be also nice if I could
- Integrate it within
tree
command (which creates a tree structure of folders and files) - Make it work on Folders and Sub folders (this is sort of important)
You could use
find
(in the directory)If you want to exclude the
md5sum.txt
file itself, you can do so:You can also use a loop: turn on recursive globbing
Then, in the directory:
You can exclude the file itself from this one as well:
Neither of these produces a
tree
-like structure. But they do print the relative path to the file from the starting directory. If you want the absolute path, usefind /path/to/directory ...
You might want to turn off globstar afterwards (
shopt -u globstar
)You can execute the following command:
The output in the result file will be something like that: