Having just been helped to get my script functioning on directories with spaces in the name (question 1447738 - thank you, again), I thought I'd like to pass its output to a text file.

Here's the script:

```
find . -type d -print0 | while read -r -d $'\0' dir; do
cd "$dir"
  for file in *.ogg *.wav *.mp3
  do
   duration=$(ffprobe "$file" 2>&1 | awk '/Duration/ { print $2 }')
   echo -e "$duration\t$file"
  done | sort -n
cd - > /dev/null
done

```

I thought I should be able to change the "echo" line to this to output to a text file:

```
echo -e "$duration\t$file" > length-check.log

```

Despite the fact that without the sdtout > the results display correctly, with the > all the log file contains is this:

> 
> \*.ogg\*.wav\*.mp3
> 
> 
> 
> 
> 
> 
> 
> 
> 

I know I could get the output by launching the script thus:

> 
> ./length-check.sh > length-check.log
> 
> 
> 

But I'd like to know where I've gone wrong within the script.

So, again, my lack of knowledge of scripting is holding me back. I'd be really grateful if someone could show me how to write this line correctly.

Many thanks, again.