Directory filenames with sed with whitespaces

I'm working with a manuscript and also I'm stuck, despite having the aid of the google.

Below's my code:

for FOLDER in `find . -type d | sed "s#^.#$(pwd)#" | sed 's/ /\ /g'`
do
    echo "$FOLDER"
done

This will certainly change just the first instance of"" with "" yet not the remainder.

Any kind of suggestions?

0
2019-05-04 05:38:43
Source Share
Answers: 3

Forget concerning structuring your command in this way and also usage find -execdir rather :

find . -type d -execdir sh -c 'pwd' \;
.

Or make use of zsh :

for d in **/*(/); do
  echo $d
done
.
0
2019-05-08 00:45:49
Source

You can make use of xargs as opposed to a loop for implementing the very same command on a checklist of components. There are alternatives to care for whitespaces.

0
2019-05-08 00:42:16
Source

I assume that you are making complex every little thing.

Possibly you just require this :

find $(pwd) -type d | sed 's/ /\\ /g'
0
2019-05-08 00:19:30
Source