Copy a file into all subfolders and subsubfolders.
I have a file say, a.txt
I want to copy it to all subfolders and all the folders within those folders. I have tried creating a script to run this, but I keeping getting errors.
Any help?
the code i was trying was below. But this only copies it into subdirectories, not subsubdirectories
for i in ./* # iterate over all files in current dir
do
if [ -d "$i" ] # if it's a directory
then
cp a.txt "$i" # copy a.txt into it
fi
done
cd ..
done