Delete a set of files on a particular system date
Moderator: DosItHelp
-
- Posts: 1
- Joined: 22 Feb 2014 03:01
Delete a set of files on a particular system date
we have few excel and word documents in a folder and that needs to be deleted on a particular date automatically and regularly.
These excel files are temporarily exported from our accounting software .
For eg. we need to delete files in BACKUP folder in c:\ on system date turning 1st. If it misses the cycle, it should delete next month 1st.
Thanks in advance
These excel files are temporarily exported from our accounting software .
For eg. we need to delete files in BACKUP folder in c:\ on system date turning 1st. If it misses the cycle, it should delete next month 1st.
Thanks in advance
Re: Delete a set of files on a particular system date
Task Scheduler will run a batch file on the 1st every month.
Re: Delete a set of files on a particular system date
I use this code to do a time match. I'm sure the same logic could be used with %DATE% to check the date or day:
Code: Select all
:START
SET CURTIME=%TIME:~0,-6%
IF NOT "%CURTIME%"=="10:00" GOTO START
Re: Delete a set of files on a particular system date
Samir wrote:I use this code to do a time match. I'm sure the same logic could be used with %DATE% to check the date or day:Code: Select all
:START
SET CURTIME=%TIME:~0,-6%
IF NOT "%CURTIME%"=="10:00" GOTO START
But you would still have to then run the batch file every day. If you just have Windows Task Scheduler run it on the 1st day of the month then there is no need to check the date.
Re: Delete a set of files on a particular system date
True, but I trust a batch file to autostart more than I trust windows task scheduler.Squashman wrote:Samir wrote:I use this code to do a time match. I'm sure the same logic could be used with %DATE% to check the date or day:Code: Select all
:START
SET CURTIME=%TIME:~0,-6%
IF NOT "%CURTIME%"=="10:00" GOTO START
But you would still have to then run the batch file every day. If you just have Windows Task Scheduler run it on the 1st day of the month then there is no need to check the date.
Re: Delete a set of files on a particular system date
Samir wrote:True, but I trust a batch file to autostart more than I trust windows task scheduler.Squashman wrote:Samir wrote:I use this code to do a time match. I'm sure the same logic could be used with %DATE% to check the date or day:Code: Select all
:START
SET CURTIME=%TIME:~0,-6%
IF NOT "%CURTIME%"=="10:00" GOTO START
But you would still have to then run the batch file every day. If you just have Windows Task Scheduler run it on the 1st day of the month then there is no need to check the date.
Well I will disagree with you all day and all night on that point. I do Automation for a Living. We have over 600 automated tasks that run every day. I would say about 100 of these are triggered by Task Scheduler every day. All these tasks are spread out over 3 application servers. Hasn't failed us yet.
Re: Delete a set of files on a particular system date
Your luck has been better than mine. If something crashes the kernel or task scheduler, it's hosed in my case. So I just trust a simple batch file to do it as they usually survive such problems.Squashman wrote:Well I will disagree with you all day and all night on that point. I do Automation for a Living. We have over 600 automated tasks that run every day. I would say about 100 of these are triggered by Task Scheduler every day. All these tasks are spread out over 3 application servers. Hasn't failed us yet.

Re: Delete a set of files on a particular system date
Samir wrote:Your luck has been better than mine. If something crashes the kernel or task scheduler, it's hosed in my case. So I just trust a simple batch file to do it as they usually survive such problems.Squashman wrote:Well I will disagree with you all day and all night on that point. I do Automation for a Living. We have over 600 automated tasks that run every day. I would say about 100 of these are triggered by Task Scheduler every day. All these tasks are spread out over 3 application servers. Hasn't failed us yet.
The stuff I have been managing has been running for 5 years without a hitch. Task Scheduler has never failed us.
Even in my Unix days, CRON never failed me.
I would rather not have a batch file constantly running and checking something. On a Windows Vista and above, every time you start a batch file it launches two processes. CMD.exe and Conhost.exe. If I did that with all my batch files I would have over 200 processes running.