Win 7 Pro: Need script to delete oldest file in directory


  1. Posts : 16
    Windows 7 Pro 64 bit
       #1

    Win 7 Pro: Need script to delete oldest file in directory


    Howdy,

    I use a cloning program that automatically clones c: to e: (external drive) on a daily basis. I would like to automatically run a daily script (or something) to delete the oldest clone on the drive. I have absolutely no experience with scripting so if someone could offer simple instructions and code, or a pointer to same, it would be GREATLY appreciated.

    Thanks for any input that you might offer!
      My Computer


  2. Posts : 983
    7 x64
       #2

    Typically a clone of a drive to another replaces what is on the target drive with what is on the original. So if you are cloning you shouldn't have old copies/versions.

    So you are not cloning, correct?

    What program are you using for whatever you are doing?
      My Computer


  3. Posts : 16
    Windows 7 Pro 64 bit
    Thread Starter
       #3

    Sorry, wrong terminology. It's creating a disk image of the drive. Each day, a new image. I just want to delete the oldest image each day so that there's room for a new one.

    Macrium Reflect Free is the program.

    Thanks.
      My Computer


  4. Posts : 983
    7 x64
       #4

    Ok thanks for the update. I'm not sure I have an answer for you but you may be able to setup a Batch File that will do the deleting, First, then Run the Image program. starting that batch file from a Scheduled Task.

    Not sure what would be needed in the Batch file but a google search for batch file commands may help.
      My Computer


  5. Posts : 16
    Windows 7 Pro 64 bit
    Thread Starter
       #5

    That's what I was looking for here... a batch file that could be scheduled to run daily. Thanks for your input.
      My Computer


  6. Posts : 67
    MS Windows 7 Home Premium 64-bit SP1
       #6

    I searched for "batch file delete macrium reflect old image" and found this:

    Macrium Reflect Free Edition: Cleanup old images with Macrium Free Edition automatically - AlternativeTo Forums

    There might be other links to consider in the results.
      My Computer


  7. Posts : 16
    Windows 7 Pro 64 bit
    Thread Starter
       #7

    Thanks monkeylove. I think I'll try delage32, which was mentioned at the URL that you provided.
      My Computer


  8. Posts : 16
    Windows 7 Pro 64 bit
    Thread Starter
       #8

    To put this to rest, I installed delage32, created a simple batch file to keep the number of images within the capacity of the drive and scheduled it to run daily. It does what I need and it saved us 45 bucks (the price of Macrium Reflect Standard, which is capable of managing disk space). Thanks to those that responded.
    Last edited by GrouchyHermit; 13 Oct 2012 at 17:48.
      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 08:43.
Find Us