On Wed, 6 Oct 1999, Niclas Hedhman wrote:
>
> I have made a script for recursive listing of files in directories...
>
> #!/bin/sh
> # Creates a standard output stream of all files matching the pattern in
> parameter $1, including the path.
>
> for FILE in $(ls $1 2>/dev/null); do
> echo \"$(pwd)/$FILE\"
> done
>
> for DIR in $(ls) ; do
> if [ -d $DIR ] ; then
> cd $DIR ;
> recursive $1 ;
> cd ..
> fi
> done
>
> The output will contain the full path to the files, and I have quotes
> (") around to handle space in directory/file names.
>
> But, if I do a
>
> rm $( recursive *.abc)
>
> the script processor will break a directory name at the space, serving
> 'rm' with multiple files, such as
>
> original;
> "/home/niclas/java dev/project/file.abc"
>
> as
> "/home/niclas/java
> dev/project/file.abc"
>
> Resulting in complete failure.
> Can anyone explain why and if there is anything I can do about it, not
> including removing the spaces in directory and file names?
> Perhaps there is a command that does what I need, and that is well and
> dandy, but I would still want an answer for future scripting experience.
>
The command is :
find . -name "*.abc" -print
Don't know what's wrong with your script however
Frank
>
> Niclas
>
>
HI! I'm a .signature virus! cp me into your .signature file to help me spread!