Last active
July 10, 2023 11:23
-
-
Save alivx/7f1c088c336e63dc17d8fffdbf2d8363 to your computer and use it in GitHub Desktop.
List file name and content
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
#!/bin/bash | |
# Predefined list of directories | |
dir_list=( | |
dirlist | |
) | |
# List of file types to exclude | |
exclude_list=( | |
"*.zip" | |
"*.log" | |
) | |
for dir in "${dir_list[@]}"; do | |
find "$dir" -type f \( ! -name "${exclude_list[0]}" \ | |
-a ! -name "${exclude_list[1]}" \) \ | |
-a ! -path '*/.terraform/*' \ | |
-a ! -path '*/.git/*' \ | |
-exec sh -c 'echo "File: {}"; echo "Content:"; cat {}' \; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment