batch file that will delete files by date

Discussion in 'Software' started by beetleboy, Feb 7, 2006.

  1. beetleboy

    beetleboy Private E-2

    I am in need of some help writing a batch file that will delete files out of the specified folder. i have a folder named "backup" and within "backup" i have files that are named:
    backup013106.bak
    backup020106.bak
    backup020206.bak
    backup020306.bak
    backup020406.bak
    backup020506.bak
    backup020606.bak
    so i already have a batch file that copies the new backups into this folder and renames them by date but i would like to add to the file for it to keep only the 2 most recent backups and delete the older ones when ran. any ideas? thanks!
     
  2. dedub

    dedub Corporal

    I'm not sure if it is possible with a batch. You may have to move to .vbs script to run a more powerfull *if-than* statement. I could be wrong though.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds