Detectiion and Tranfering files to USB automatically
I am new to linux. for one my new project ,the requirement is
we will have a textfile(.txt) in a local harddisk of the Desktop which is having linux OS(Red Hat Enterprise Linux 4) with kernel version 126.96.36.199. We need to write a small application program in C language which will do the following action:
1) Whenever the USB is connected in the Desktop, the C program has to transfer the textfile to the USB disk automatically.
For executing this we would like to clarify the followings:
a) How to find the presence of USB disk through my C program?
b) How to transfer the textfile to USB disk through my C program automatically after detecting the USB disk?
If any one can give a solution for this, it will be really helpful.