BashUSBCopy
Bash script to automatically copy file on USB drive when plugged in
Install / Use
/learn @stonfute/BashUSBCopyREADME
BashUSBCopy
Bash script to automatically copy file on USB drives when it's plugged on USB port. Used to make massive copies of files on usb drives (usb drives gifted during conference).
Features :
- Automatic launch when an USB drive is plugged in
- Automatic mount of ntfs USB drive (can be manualy changed to non ntfs partition)
- Automatic copy of a whole folder (including sub-folders, keeping the hierachy)
- Automatic notification on the desktop when copy is done (using notify-send)
- Automatic umount after copy
- Support multiple USB drives at the same time (
usbhook.shis called each time)
Setup :
General setup :
Please add that command in /etc/udev/rules.d/99-usbhook.rules to run script when an usb drive is plugged in
ACTION=="add",KERNEL=="sd*", SUBSYSTEMS=="usb", ATTRS{product}=="*", RUN+="/home/stf/usbhook.sh %k"
(Change run command according to the location of that script)
Run sudo udevadm control --reload-rules to update udev rules
Create log file (according to the configuration in usbhook.sh) > sudo touch /var/log/usbhook
In usbhook.sh :
- Don't forget
chmod +x usbhook.sh - Edit the path
SRC(line 25) according to the source folder that you want to copy on usb drives - Edit the
mountcommand (line 40) if you don't want to use ntfs partition - Edit the user
stfby your own username insudocommand at line 51 if you want to see notification on desktop
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
