Hello Everyone
I have big problem with a simply script. I need automatic copy all files from USB pendrive to my folder in HDD, every time when I will plug USB device.
I used rule :
ACTION=="add", KERNEL=="sd?", SUBSYSTEM=="usb", RUN+="/home/art/bin/copy.sh"
and (first) script copy.sh
#!/bin/sh
mountdir="/media/`blkid /dev/sd? | awk {'print $2'} | sed -e 's/LABEL=//' -e 's/"//g'`"
dstdir="/home/art/Wideo/"
mkdir -p $dstdir
cp -r $mountdir $dstdir
chmod -R 777 $dstdir
(second)
#!/bin/sh
find /media/ -name "*[mpg|avi|mov|mp4]" -exec cp {} /home/art/Wideo \; chmod -R 777 /home/art/Wideo
Unfortunetly both of scripts works when I run them from file, but not working when i plug my USB device.
I have Ubuntu 11.04
Any suggestions?
Bookmarks