I have a folder called exam. This folder has 3 folders called math, physics and english. All of these folders have some sub folders and files in them. I want to traverse through every folder and print the path of every folder and file on another file called files. I've done this:
#!/bin/bash
LOC="/home/school/exam/*"
{
for f in $LOC
do
echo $f
done
} > "files"
The exit I get is:
/home/school/exam/math
/home/school/exam/physics
/home/school/exam/english
I can't figure out how to make the code visit and do the same thing to the sub folders of exam. Any suggestions?
PS I'm just a beginner in shell scripting.