You just need to use $f
to refer the items in your find
result, instead of f
. And also, include /index.html
to the path:
for f in $(find . -type d); do echo "hello" >> $f/index.html; done
^^^^^^^^^^^^^
In your current code you were redirecting to the constant f
, while you want to refer to the variable name $f
. That is the reason of using $f
instead of f
.