Article 5A91A Handling space in parameters

Handling space in parameters

by
rac8006
from LinuxQuestions.org on (#5A91A)
I've searched every where I can think of and can't find an answer. I'm trying to find all of the directories in a partition and count the files. The problem that I'm having is that some of the directory names have a space in them. I did the following:
find . -maxdepth 1 -type d -print > dirs
then I wanted to do for i in `cat dirs`
do
echo -n $i
find "$i" -print|wc
done

I tried several different things but none of the worked.

What I finally got to work was
find . -maxdepth 1 -type d -exec sh myscript.sh {} \;

myscript.sh
echo -n "$1"
find "$@" -print|wc

Is there a better way to do this?

Thankslatest?d=yIl2AUoC8zA latest?i=naXivL2grxQ:qYuMsbcaZz4:F7zBnMy latest?i=naXivL2grxQ:qYuMsbcaZz4:V_sGLiP latest?d=qj6IDK7rITs latest?i=naXivL2grxQ:qYuMsbcaZz4:gIN9vFwnaXivL2grxQ
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments