Windows 7 Forums


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

12 Oct 2012   #1

Windows 7 Pro 64 bit
 
 
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 System SpecsSystem Spec

12 Oct 2012   #2

7 x64
 
 

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 System SpecsSystem Spec
12 Oct 2012   #3

Windows 7 Pro 64 bit
 
 

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 System SpecsSystem Spec
.


12 Oct 2012   #4

7 x64
 
 

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 System SpecsSystem Spec
12 Oct 2012   #5

Windows 7 Pro 64 bit
 
 

That's what I was looking for here... a batch file that could be scheduled to run daily. Thanks for your input.
My System SpecsSystem Spec
13 Oct 2012   #6

MS Windows 7 Home Premium 64-bit SP1
 
 

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 System SpecsSystem Spec
13 Oct 2012   #7

Windows 7 Pro 64 bit
 
 

Thanks monkeylove. I think I'll try delage32, which was mentioned at the URL that you provided.
My System SpecsSystem Spec
13 Oct 2012   #8

Windows 7 Pro 64 bit
 
 

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..
My System SpecsSystem Spec
Reply

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



Thread Tools



Similar help and support threads for: Win 7 Pro: Need script to delete oldest file in directory
Thread Forum
How can I find the oldest file? Music, Pictures & Video
File directory: Many directory bear the same name after hd replacement Performance & Maintenance
Files that I can delete off of Main HD directory Performance & Maintenance
Directory and files there but can't delete, move or rename General Discussion
Solved How to properly delete Symlinks (Directory Junctions) General Discussion


All times are GMT -5. The time now is 03:21 PM.


Seven Forums Android App Seven Forums IOS App Follow us on Facebook

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
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32