bash script to check USB in linux

I need a bash script to check connected/disconnected usb with linux.

I know command lsusb can be use to list down usb connect with linux. output of lsusb command is like this:

Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 0951:1643 Kingston Technology DataTraveler G3 4GB
Bus 001 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub

Device 002 is only usb in above text. Now I want to get Size of USB and Name of USB and output it in some file. but size can be different. in gb or in mb or in tb.

thanks in advance.

Also do tell me if there is some other way to handle this issue.

Since you have Linux, try:

fdisk -l /dev/disk/by-path/*usb* 2>/dev/null