To delete all files including rar and zip from external drive

urparagjyoti

Distinguished
Feb 25, 2009
2
0
18,510
Hi sir,


I have a query regarding vbscript.My question is i want to delete all the files including .rar,zip and other when i insert any external media to my pc.Plz help me

Thanks in advance
 

pat mcgroin

Distinguished
Nov 21, 2007
1,687
0
19,960
You can do it with a batch file but your question may be more difficult as you say "any' external media.
If you insert more than one external device you must be concerned with drive letters.

For example del e:\*.rar /s will delete all rar files on the e: drive including all sub directories but if you have a external HDD that is e: and put in a flash card the card will become f: and you may end with undesired results.

Being that external devices insertion can be dynamic I dont think a script can be used.
I believe that it will have to be done manually and with a varible so as to ask which drive do you want to do this to.
 

urparagjyoti

Distinguished
Feb 25, 2009
2
0
18,510


Thanks 4 ur reply, but i am newcommer in this field so will help me to the send code of the script file and how i will attach it with the autorun.inf??

Thankx in advance
basically i hve an external hrd disc so i want to delete all the file automatically when i insert it in my usb