Skip to content

Instantly share code, notes, and snippets.

@tpowellcio
Created May 24, 2016 12:48
Show Gist options
  • Save tpowellcio/51c319c72ee497b22de9bb85ef922c07 to your computer and use it in GitHub Desktop.
Save tpowellcio/51c319c72ee497b22de9bb85ef922c07 to your computer and use it in GitHub Desktop.
Copy files to USB sticks and unmount

#Copy files to USB sticks and unmount

##Mac copy2usb.sh

#!/bin/bash

DEVICES=/Volumes/U*
for device in $DEVICES
do
	echo "Copying Files to $device"
	# take action on device
	
	rsync -acP --delete ~/uploads/anaconda/ "$device"/
	
	echo "Finished Copying Files to $device"
	# mv "$f" Filename
	echo "Unmounting $device"
	
	diskutil unmount "$device"
	
	echo "Finished Processing $device"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment