I am going to teach you how you can do this from batch file with the help of autorun.inf file. Let me tell you the basic things what will happen.
When you plug in in your Pen drive, system will look up for autorun.inf and after you click 'yes' to autorun,it will execute the batch file and hence copy all files to pendrive.
INSTRUCTIONS :-
STEP 1) Copy and paste the following code to notepad and save it with filename.bat