Skip to content

Instantly share code, notes, and snippets.

@LeoAdamek
Created October 17, 2011 17:56
Show Gist options
  • Save LeoAdamek/1293276 to your computer and use it in GitHub Desktop.
Save LeoAdamek/1293276 to your computer and use it in GitHub Desktop.
A "Simple" Script to take all text files in a directory and put them into one collated file, usefull if you have an assignment with requires it
#!/bin/bash
for filename in $(find . -type f)
do
f_type=$(file -b $filename)
if [ "${f_type##* }" == "text" ]
then
echo "###################### FILE: ${filename} #######################" >> collated_code.txt
cat ${filename} >> collated_code.txt
echo "###################### END FILE ${filename} ####################" >> collated_code.txt
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment