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.

Batchfile: Delete Files every X Days

Discussion in 'Windows XP' started by Wajaja, Oct 26, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. Wajaja

    Wajaja Thread Starter

    Joined:
    Oct 26, 2007
    Messages:
    4
    Hello!

    I'd like to make a Batchfile that deletes Files in a specific Folder that are older then "30"days. Now what it should do first is Delete all Files in all Subdirectorys which are older then "30" Days... and then if the Subdirectorys are older then "30"Days delete the Subdirectorys if they're empty.

    Help!
     
  2. devil_himself

    devil_himself

    Joined:
    Apr 7, 2007
    Messages:
    4,910
  3. Wajaja

    Wajaja Thread Starter

    Joined:
    Oct 26, 2007
    Messages:
    4
    So those examples you gave me reffer to Visual Basic? Isn't it possible to do with a batchfile?
     
  4. devil_himself

    devil_himself

    Joined:
    Apr 7, 2007
    Messages:
    4,910
    why do you want a Batch if there are other sources

    this little prog does the same
    http://www.jpsdomain.org/public/tools/obslt10.zip

    ============================================================
    OBSOLETE: Clean old junky files. Version 1.00. Jul 05 1992
    Copyright (c) 1991 by Yossi Gil, P.O.Box 3148, Jerusalem, ISRAEL.

    Usage: obsolete [flags] age [-f] pattern [dir]

    Will recursively remove all files which older than 'age' which match 'pattern'.
    Recursive scan starts from the current working directory or from 'dir' if
    specified. 'age' is a sequence of pairs <N unit> where N is an optional number
    and 'unit' is seconds, minutes, hours, days, weeks, moths or years. 'flags' are
    one or more flag characters preceded by "- optionally followed by "+" for
    turning flag on (default), or "-" for turning it off.

    FLAGS -h Print this message and exit
    -H+ Remove hidden files too -R- Do not recurse into subdirectories
    -S+ Remove system files too -W+ Remove write protected files too
    -i+ Ask before removing file -I+ Ask before overriding write protect
    -s Silent: don't list files -n Do nothing: just list files

    EXAMPLES
    obsolete 2 weeks *.tdk c:\ Remove all drive C: 2 weeks old .tdk files
    obsolete -R- 2 days *.bak Remove 2 days old .bak files from current dir
    obsolete day *.* \brief\backup Remove day old files from backup dir
    obsolete -n 3 years *.exe \bin List all 3 years old .exe files in \bin
    obsolete -s -HSW second *[email protected]@@ \ Silently remove ALL (junk?) [email protected]@@ files
     
  5. Wajaja

    Wajaja Thread Starter

    Joined:
    Oct 26, 2007
    Messages:
    4
    Cause it needs to be a Batchfile. I know of other solutions.
     
  6. Wajaja

    Wajaja Thread Starter

    Joined:
    Oct 26, 2007
    Messages:
    4
    Well?
     
  7. Sponsor

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/643724

  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