To delete all files including rar and zip from external drive

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
3 answers Last reply
More about delete files including external drive
  1. 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.
  2. pat mcgroin said:
    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.


    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
  3. tbh this isnt really the best place to ask for VBscript help, there might be one or two experts here if your lucky, but i would do a search on google and find a vbscript specific forum.

    heres some useful sites...


    try posting this question here: http://www.tek-tips.com/threadminder.cfm?pid=329&page=1

    some good examples to look at: http://www.scriptinganswers.com/vault/
Ask a new question

Read More

External Drive Zip Windows XP