1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Delete old folders and files using VB6 code

Discussion in 'Software Development' started by gmoukled, Dec 1, 2011.

Thread Status:
Not open for further replies.
  1. gmoukled

    gmoukled Thread Starter

    Oct 17, 2011
    I am new to VB 6.0, and I need a code that looks for specific folders and files in my C drive and delete all the files that are older than 2 years.

    My C drive has a lot of folders and sub folders...

    I would like my code to go through the first folder and keep drilling in all the subfolders until it hits the end, and then go back to second folder and do the same etc..., looking for any folder or file older than 2 years.

    Now i do not want the code to delete the folder or file according to the date it was modified , but according to its name.
    The names are of 2 different forms: "yyyy-mm-dd" and "yyyy_mm_dd" ( note the difference between the dash and the underscore)

    for example: today is 2011-12-01, so my code will look for anything earlier than 2009-12-01 and delete it.

    Could some one provide me with the code please? This is the first time I deal with VB6.

  2. Squashman

    Squashman Trusted Advisor

    Apr 4, 2003
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1029195

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice