Computer Plumber
  • About
  • Services
  • Contact
  • Policies
  • How to use a Windows .bat file to delete files on a schedule

    This is how you delete files of a certain age using a scheduled task to execute a .bat file. These instructions mainly apply to Windows Server 2012 R2, but they are applicable to most newer (and older) versions of Windows. This is similar to the post I made many years ago but with some additions mainly around the commands you need to find files that are older than a certain date and then deleting them. It also focuses on Server 2012 R2 versus the older 2008.

    The first thing we want to do is create the batch file that we will use to delete the files older than X days. To do this we will need to use the forfiles command in Windows. This is a very handy command for batch files IMO. Here is a run down of the forfiles command and how to use it:
    Read the rest of this entry »

    Share
    No comments command line, Microsoft, scripts, Server 2012, Windows
  • Run a Batch File as a Scheduled Task

    Sometimes the most mundane daily tasks can be simplified with a simple batchfile. Say you have a USB drive that you keep your files on that you copy files to several times a day. You could invest in synchronization software, or you could just create a batch file that will copy the files for you. I am paranoid so I like to backup files at least once a day, this is how you setup a scheduled task to run a batch file. If you need help writing a batch file, just leave a comment.




    Read the rest of this entry »

    Share
    4 comments command line, Microsoft, Server 2008, Server 2012, Server 2016, Windows 10, Windows 2000, Windows 7, Windows 8, Windows NT, Windows Vista, Windows XP

Pages

  • About
  • Contact
  • Policies
  • Services

Categories

  • Amazon (13)
  • Databases (11)
  • Linux (48)
  • Mac (35)
  • Rails (13)
  • Virtual (8)
  • Web (33)
  • Windows (35)
  • follow me on Twitter

 

Computer Plumber | Computer Service Excellence