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.
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?
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.
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.
OS MS Windows 7 Home Premium 64-bit SP1 CPU Intel Core 2 Quad Q6600 @ 2.40GHz Motherboard ASUSTeK Computer INC. P5B-VM SE (LGA775) Memory Corsair PC2-6400 (400 MHz) 4.00 GB DDR2 Graphics Card GeForce 9600 GT 1024 MB Sound Card SB Audigy Monitor(s) Displays LG W2252 Screen Resolution 1680x1050 @ 60Hz
Keyboard Microsoft Sidewinder X6 Mouse Microsoft Sidewinder Mouse PSU Corsair HX750W Case Antec 900 Cooling Thermaltake fans Hard Drives 977GB Seagate ST31000528AS ATA Device (SATA)
488GB Seagate ST3500630AS ATA Device (SATA) Internet Speed 2 Mbps Other Info D-Link DIR-655 router
WD My Book 1.0 TB
Buffalo NAS LS-CHL v2 2 TB
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 05:48 PM..