Hi,
I've been working on a way to automatically convert some of my TiVo files with a shell script. I'm using tivodecode to accomplish the actual conversion from a .TiVo file to a .mpg file.
My problem is when a TiVo file arrives, it's full of spaces. For example:
Code:
-rw-r--r-- 1 root root 388959059 Feb 2 18:03 Ask This Old House - Window pane; safety glass (Recorded Sun Mar 18 2007 06 30AM AETV).TiVo
I've written a simple script to convert this using tivodecode:
Code:
#!/bin/bash
cd /data/videos
for a in $(ls -1 *.TiVo) ; do tivodecode -o $a.mpg $a ; done
The problem appears to be the spaces in the file names. When they're read into the
a variable, they aren't escaped correctly, so tivodecode fails.
How can I escape these properly in my shell script? Escaped properly, tivodecode works well. I'd like to keep the spaces (as heinous as they are) in the file name since this is what certain applications I'm using like.