Created
October 17, 2011 17:56
-
-
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
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 | |
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