Cat multiple files is larger text file

I am looking to take all the text files in a directory, and put them into another text file that has the name of the text file, it's time stamp, and then the contents of the text file.
stakorAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
wilcoxonConnect With a Mentor Commented:
You can do that pretty easily in just shell...
touch combined.txt # may or may not be necessary based on your settings
for i in dir/*.txt; do # replace dir/*.txt with whatever you want - should not be current dir
ls -l $i >> combined.txt # will include a few extra bits of info about the file
cat $i >> combined.txt
end

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.