[LBo] Finding and processing filenames that contain spaces

Dave Lerner 7dvbyfk02 at sneakemail.com
Mon Jan 15 17:31:33 CET 2007


This is a script I wrote for testing the integrity of my backups to CD.
 It checks all the .zip and .tar.gz files on the CD.

I'd like to make this more "robust" so that it can handle filenames that
contain spaces.  Any ideas on how to do that?

-----
#!/bin/sh

# Limitation: filenames cannot contain spaces.

mount_point='/mnt/cdrom1'

mount $mount_point

echo Testing files ...

gz_files=`find $mount_point -name "*.gz"`
for file in $gz_files
do
   gzip -tv $file
done

zip_files=`find $mount_point -name "*.zip"`
for file in $zip_files
do
   unzip -tvq $file
done

eject $mount_point
-----



More information about the QnA mailing list