Last active
April 14, 2023 15:54
-
-
Save mertyertugrul/894d74a40966abf2c0c1956e689faf61 to your computer and use it in GitHub Desktop.
Code that copy the code base recursively for a given path
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
# write the path here | |
dir="" | |
# Set the array to store file contents | |
contents=() | |
# Use the find command to locate all .java and .py files in the directory tree | |
while IFS= read -r -d '' file; do | |
# Read the contents of the file and add them to the array | |
contents+=(" File name: $(basename "$file") ==== | |
$(cat "$file")"$'\n') | |
done < <(find "$dir" -type f -print0) | |
# Print out the file contents in the array | |
printf '%s\n' "${contents[@]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment