Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #create rule
- sudo vim /etc/udev/rules.d/99_move_photos.rules
- ACTION=="add", KERNEL=="sd?[0-9]", SUBSYSTEM=="block", RUN+="/usr/local/bin/move_photos"
- #reload rules
- sudo udevadm control --reload
- #/usr/local/bin/move_photos script
- #!/bin/sh
- if [ "${ACTION}" = add -a -d "/sys${DEVPATH}" ]; then
- echo "add ${DEVNAME}" >>/tmp/test.log
- mkdir -p /tmp/photos/
- mount ${DEVNAME} /mnt
- mv /mnt/* /tmp/photos/
- umount /mnt
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement