Skip to content

Instantly share code, notes, and snippets.

@mertyertugrul
Last active April 14, 2023 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mertyertugrul/894d74a40966abf2c0c1956e689faf61 to your computer and use it in GitHub Desktop.
Save mertyertugrul/894d74a40966abf2c0c1956e689faf61 to your computer and use it in GitHub Desktop.
Code that copy the code base recursively for a given path
# 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