I am trying to write some files in usb when connect it in linux..
Actually, I have a file in in /etc/udev/rules.d/
with:
ACTION=="add", ENV{ID_FS_UUID}=="9FE8-99G3", RUN+="/usr/bin/sudo -u myuser /home/myuser/Scripts/mycrazy.sh"
In mycrazy.sh
, I have:
## Path to mounted device
PATH_USB=/run/media/myuser/9FE8-99G3
mkdir $PATH_USB/some_folder
mkdir /home/myuser/Documents/another_folder
The first mkdir, doesnt works. But the second, works.
How can I write files in usb? Is missing something in my script?
/dev/sdxY
as your script does. But your script is so fast. Try putting a short delay at the beginning examplesleep 3
, you may lower it if it does work