We help IT Professionals succeed at work.

Require variables for scirpt to delete SQL back-up files older than 30 days

275 Views
Last Modified: 2013-11-05
Hi all,

I require a date range or date modified variable for a script that will be designed to delete all files from a folder older than 30 days.

Currently this folder of ours is growing at around 3GB+ a day, so rather than monitoring it every month I would like to schedule a script to do it for us.

I was thinking of using the del command but as it stands I cannot get the syntax correct.

Any help would be appreciated.

Cheers
Comment
Watch Question

Brian PiercePhotographer
CERTIFIED EXPERT
Awarded 2007
Top Expert 2008

Commented:
Is it the transaction logs that are growing - if so I suggest you read http://support.microsoft.com/kb/873235 before you delete anything !!

Author

Commented:
Thanks for the prompt reply.

The folder in question is not important. It is a folder called "DatabaseBackups" that has been created for quick restore purposes. We currently back the contents of this folder up daily onto tape through Backup Exec, so it is not destructive in removing these files.

In total each day, 4 files are created to the total of 3GB+. .bak & .trm are the largest.

Rest assured it is safe to delete these files  =]
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.