formatCamcard.sh

#!/bin/bash
 
DEVICE=/dev/sdc
LABEL=CAMCARD
 
# create partition
sudo umount ${DEVICE}1
sudo fdisk ${DEVICE} << EOF
o
n
p
1
 
 
a
1
t
6
w
EOF
 
# create filesystem
sudo umount ${DEVICE}1
sudo mkfs.vfat -F 16 -n ${LABEL} ${DEVICE}1
 
# sync changes
sudo sync
 
# create directory structure
#sudo mount ${DEVICE}1 /mnt
#mkdir -p /mnt/DCIM/100NIKON
#sudo umount ${DEVICE}1