Created
January 4, 2020 22:48
-
-
Save matthewpoer/ce32a109191c71a67305bb1e405a42b7 to your computer and use it in GitHub Desktop.
Get information about the files within a directory, including list of files, their sizes and md5 hashes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env bash | |
# for a given directory myDirectory, create a list of all files within that directory | |
# note that file names are not enclosed in quotes here | |
find myDirectory -type f -exec echo {} \; > myDirectory.files.text | |
# if you want them in quotes, | |
# find myDirectory -type f -exec echo \"{}\" \; > myDirectory.files.text | |
# and a list of the sizes of each of these files | |
find myDirectory -type f -exec echo \"{}\" \; | xargs -n1 du -sh > myDirectory.files.sizes.text | |
# and a list of the sizes of each of these files | |
find myDirectory -type f -exec echo \"{}\" \; | xargs md5 > myDirectory.files.md5.text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment