A good way to list all file names (probably with whitespace) in bash

Typical find . bash command interprets a file with whitespace in name into multiple files.
To avoid this problem, use the following construct,
 
find . -iname "foo*" | while read f
do
    echo ${f}
done
 
Reference 
 
To eliminate leading ./ in the listed file names, change the code above to the following.

find . -iname "foo*" | while read f
do
    echo ${f#./}
done

Reference

Comments

Popular posts from this blog

Play octoshape stream on windows with VLC player

Using PlayStation 1 Densha de Go controller on emulators

Sleeping dogs definitive edition + xbox360ce