-1

My goal: To have video copied from an SD card that is inserted into a Pi 4B using a USB SD Card reader copied to a network share and put in folders based on dates.

My scenario. I come home from driving and remove the SD card from my dashcam and pop it into the SD reader. The PI detects the card added and copies the files to the network share sorting them into folders based on date. After verifying the files the car is unmounted so I can take it back to the car for the next day.

I have no programming experience so I don't know where to start. I assume each SD card has a unique serial # so I can poll the system every so often to see if a card meeting the specific serial numbers are inserted then list the file and using some processing of that list come up with a script of what to copy.

1 Answer 1

0

I'm no expert but udev should be able to handle that if you have a script already set for the copy/SD cleaning
First, you'll need to identify the SD volume label (ID_FS_LABEL). To do so, run udevadm monitor -p and insert the SD card. Some info will show, that's what you need.
Then, in /etc/udev/rules.d/ create a .rule file with something like
KERNEL=="mmcblk<YourSDCardSlot>",ENV{ID_FS_LABEL}="<YourVolumeLabel>",ACTION=="change",RUN+="/path/to/yourscript.sh"
Again, I'm not udev expert, but that's definitely the way I'd try it!

1
  • Thank you. This helps I will experiment later. Commented Aug 14, 2022 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.