Automating mounting of ISO images

Chuck Swiger cswiger at mac.com
Wed Mar 23 19:11:37 UTC 2011


Hi--

On Mar 23, 2011, at 11:49 AM, Ryan Coleman wrote:
> Disc images are located in /mount/disc_images/ (all are ISOs)
> They need to mount into /mount/office_files/images/FILENAME [without the .iso extension]
> 
> How can I do this? I've always been given these types of scripts in the past at an old job but I don't have access to those examples anymore.

Something like this might do (untested, though):

#! /bin/sh                                                                                                  

for FILE in /mount/disc_images/*; do
   DEST=$FILE:r
   mount -t cd9660 /dev/`mdconfig -f ${FILE}` /mount/office_files/images/${DEST}
done

Might need to add quotes if you have spaces or other unusual characters in your ISO filenames....

Regards,
-- 
-Chuck



More information about the freebsd-questions mailing list