Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


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

12 Oct 2012   #1
GrouchyHermit

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
edwar

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
GrouchyHermit

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
edwar

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
GrouchyHermit

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
monkeylove

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
GrouchyHermit

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
GrouchyHermit

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

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




Thread Tools





Similar help and support threads
Thread Forum
Unable to delete directory.
I'm hoping somebody can help me here, I recently moved my Dropbox directory and bungled a few things. At the moment everything seems functional except that I cannot delete one of the folders left from before the move. The folder is 0 Bytes. It is Read-Only and I am unable to change that. Under...
Performance & Maintenance
is c/boot directory needed? may delete it?
when i have installed windows 7 ultimate then i didnt had this folder . but this time i am getting this boot folder,,,,is it required folder or not? why this is seen this time and not previous installtion of win7? may i delete this ? is there any wrong going if i delete this? please help me pic...
Performance & Maintenance
How can I find the oldest file?
So basically, I got an embarassing folder and I want to find the oldest file in there. I had a bad experience with Seagate so all the "date created"s HAVE been reset to 10/27 but date modified will work fine. When you download something the date modified also is made to the time you downloaded it,...
Music, Pictures & Video
Can't delete directory on external hard drive
I have an external 1 TB hard drive. Its usually connected to an XP machine, but I can move it to a Win 7 machine. I am unable to delete a directory. I got a hint to try using the CMD window. The top of the dir list is: I tried deleting the first directory using both long and short name. It...
General Discussion
Files that I can delete off of Main HD directory
I am terribly sorry if I posted this in the wrong place. I couln't really find a catagory that this could go under. This is the closest. I am cleaning out my HD, I am at the main directory and I know deleting certain files (such as C:\Windows) would screw up the system. There is tons of files in...
Performance & Maintenance
Directory and files there but can't delete, move or rename
The folder C:\ProgramData\Microsoft\Windows\Start Menu\Favorites\Hijack This is really there. I can open it in Windows Explorer and click on the links in it and they work. If I try to delete, rename or move it I get an error. From a Command Prompt, I get an error when I use the dir command:...
General Discussion

Our Sites

Site Links

About Us

Find 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 19:16.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App