What code would I use in a cmd file to delete specific backup files?

I have set up  task manager in Windows Server 2008 R2 to back up an Access 2007 DB  every hour, 12 hours/day, every week day.
These files are saved as  .accdb files in  F:\xyz

I need to write a .cmd file that will be triggered by task manager once a day to delete all .accdb files in F:\xyz that are  >  1 day old.
Thanks
PDSWSSAsked:
Who is Participating?
 
PDSWSSAuthor Commented:
0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
0
 
Bill PrewCommented:
If you don't mind using a small free command line utility, take a look at DELAGE32:

http://home.mnet-online.de/horst.muc/win/delage.htm
http://home.mnet-online.de/horst.muc/wbat32.htm

~bp
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
PDSWSSAuthor Commented:
TheHiTechCoach:
Any reason (SECURITY) not to set ExecutionPolicy in Windows Powershell to Remote Signed- Thanks
0
 
PDSWSSAuthor Commented:
I was not clear enough in my question. I need to delete the folders that contain the backup files not just the files.  Thanks
0
 
hari_b85Commented:
A simple way might be moving the older files to a new folder and then deleting them, for example,

--------------------------------------------------------------------------------------------------------------------
@Echo off
cls
md F:\xyz\Olderfiles
robocopy "F:\xyz" "F:\xyz\Olderfiles" *.accdb /e /v /r:2 /w:0 /mov /MINAGE:1
RD /S /Q "F:\xyz\Olderfiles"
0
 
PDSWSSAuthor Commented:
None of the answers provided by the experts answered the question as I needed it to be answered. Therefore, I reposted and made it clearer what I was looking for. I received an excellent answer in the repost. Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.