How do I write batch file to delete thousands of files


  1. Posts : 34
    W7
       #1

    How do I write batch file to delete thousands of files


    Was infected by the matsnu1 virus recently which encrypes and locks all your data files. Got all my files back by running matsnu1decryp.exe You need an original clean file before the virus struck for it to work out how to decrypt all your other files does does save the day. Down side is that you end up with two files. The the original and a locked version. You can just go through your hard drive and delete the locked files but I have a 1TB disk with thousands of files and folders. Since all the locked files begin with "locked" I was wondering about some sort of batch file that would do this for all folders and sub folders. I am sure I remember doing this stuff years ago with DOS but don't remember enough to try it. Grateful if anyone could let me know the DOS command for this or some other way of quickly deleting many files which have part of the name which is common to all files. They all have different extensions so cannot use that option. My drive is H:

    Regards
      My Computer


  2. Posts : 2,241
    Windows 7 Professional 32-bit (6.1, Build 7600)
       #2

    At this time there is a lot of tutorials to do *Batch files. I recommend looking at Batch File Help and Batch File Commands to try to do do this. But to delete thousands of files, you can just go to your computer security (such as NOD32 Antivirus) and clean the hard drive of the files. It worked for me when I last had that blasted virus (which was a while back). If you still have problems, contact me again and I'll try to help.
      My Computer


  3. Posts : 719
    Windows 7 Home Premium 64bit (O.E.M)
       #3

    You could probably do this with a search. Open up the H drive and type into the windows search box the word locked. Wait a while and are if anything comes up. It might not but it's worth a try.

    Stephen
      My Computer


  4. Posts : 2,737
    Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
       #4

    Tekno Venus said:
    You could probably do this with a search. Open up the H drive and type into the windows search box the word locked. Wait a while and are if anything comes up. It might not but it's worth a try.

    Stephen
    +1 :)
      My Computer


  5. Posts : 34
    W7
    Thread Starter
       #5

    Thanks for the advice guys. I used the search facility with a couple of wildcards. I used *locked*.* and this did the trick. 13800 files so glad I did not have to find them manually. Thanks to all who helped me solve this issue. Now back up and running as normal.
      My Computer


  6. Posts : 719
    Windows 7 Home Premium 64bit (O.E.M)
       #6

    drew1000 said:
    Thanks for the advice guys. I used the search facility with a couple of wildcards. I used *locked*.* and this did the trick. 13800 files so glad I did not have to find them manually. Thanks to all who helped me solve this issue. Now back up and running as normal.
    Glad you got it sorted. It feels good when I can help someone.
      My Computer


  7. Posts : 1
    Windows 7 Ultimate 64bit
       #7

    drew1000 said:
    Thanks for the advice guys. I used the search facility with a couple of wildcards. I used *locked*.* and this did the trick. 13800 files so glad I did not have to find them manually. Thanks to all who helped me solve this issue. Now back up and running as normal.
    Hi Drew I know you have it sorted now, but you may want to check out a really nifty little program called Everything!

    The fastest file finding tool I have ever known :)

    Everything Search Engine

    Hope it helps others in the future....
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:52.
Find Us