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

GrouchyHermit

New member
Local time
8:46 AM
Messages
16
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 My Computer

Computer Manufacturer/Model Number
MacBook Pro
OS
Windows 7 Pro 64 bit
CPU
2.4 GHz Intel Core 2 Duo
Memory
6 GB - 667 MHz DDR2
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 My Computer

OS
7 x64
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 My Computer

Computer Manufacturer/Model Number
MacBook Pro
OS
Windows 7 Pro 64 bit
CPU
2.4 GHz Intel Core 2 Duo
Memory
6 GB - 667 MHz DDR2
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 My Computer

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

My Computer My Computer

Computer Manufacturer/Model Number
MacBook Pro
OS
Windows 7 Pro 64 bit
CPU
2.4 GHz Intel Core 2 Duo
Memory
6 GB - 667 MHz DDR2

My Computer My Computer

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(s)
GeForce 9600 GT 1024 MB
Sound Card
SB Audigy
Monitor(s) Displays
LG W2252
Screen Resolution
1680x1050 @ 60Hz
Hard Drives
977GB Seagate ST31000528AS ATA Device (SATA)
488GB Seagate ST3500630AS ATA Device (SATA)
PSU
Corsair HX750W
Case
Antec 900
Cooling
Thermaltake fans
Keyboard
Microsoft Sidewinder X6
Mouse
Microsoft Sidewinder Mouse
Internet Speed
2 Mbps
Other Info
D-Link DIR-655 router
WD My Book 1.0 TB
Buffalo NAS LS-CHL v2 2 TB
Thanks monkeylove. I think I'll try delage32, which was mentioned at the URL that you provided.
 

My Computer My Computer

Computer Manufacturer/Model Number
MacBook Pro
OS
Windows 7 Pro 64 bit
CPU
2.4 GHz Intel Core 2 Duo
Memory
6 GB - 667 MHz DDR2
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:

My Computer My Computer

Computer Manufacturer/Model Number
MacBook Pro
OS
Windows 7 Pro 64 bit
CPU
2.4 GHz Intel Core 2 Duo
Memory
6 GB - 667 MHz DDR2
Back
Top