1.

Solve : I have a problem at month end.?

Answer»
I'm new to this and have written a simple batch file that runs every day and copies a month-to-date performance file to a 'current_month' folder.

When a new month starts I need it to copy the previous months final file from 'current_month folder to the 'archive' folder before saving down the first set of data for the new month.

No problem until the last day of the month is say Thursday 31st - I pick up that days data on Friday 1st. did i mention that I don't work weekends ? Which means it is the 3rd before I am back to run the new months first file.

How can I get the script to detect the month has changed from the last time it was run and automatically run the end of month routine before carrying on with the first file of the new month ?

Many thanks for your attention and help.
Trevwhen you reach the last day of the month, just copy the file to the archive folder. You don't have to wait to till next month when the job is run to do that. Quote from: trevorg2 on May 09, 2008, 09:32:22 AM
How can I get the script to detect the month has changed from the last time it was run and automatically run the end of month routine before carrying on with the first file of the new month ?


I won't write a batch file for you but i can suggest the logic of how to do this.

First set up your archive and populate it with last month's files.

Run the batch every work day.

Write it so that it READS the system date and isolates the month. Then it checks in a certain location to see if there is a file called e.g. thismonth.txt. If there is no such file there, it means that this is the first time you have run the batch, so it writes e.g. "05" to thismonth.txt. If there is such a file there, then the batch has been run at least once already. Open the file and compare the 2 digit string it contains with the current month number contained in the system date. If they are the same, then the month end has not passed yet and you can exit. If they are not the same, then we are into the next (or another!)* month and you can do your archive stuff and finally write the new month value to thismonth.txt. Then you can do whatever you need to do next.

* We assume for this simple DESCRIPTION that you never leave a gap long enough between runs so that more than one month end has passed.


Quote from: ghostdog74 on May 09, 2008, 09:49:51 PM
when you reach the last day of the month, just copy the file to the archive folder. You don't have to wait to till next month when the job is run to do that.

Read his post, he mentions the problem of a month change happening on a non-working day when he is absent.
Quote from: Dias de verano on May 10, 2008, 02:25:35 AM
Quote from: ghostdog74 on May 09, 2008, 09:49:51 PM
when you reach the last day of the month, just copy the file to the archive folder. You don't have to wait to till next month when the job is run to do that.

Read his post, he mentions the problem of a month change happening on a non-working day when he is absent.

Read his post also, that his batch file copies files everyday. So when it reaches the last day of the month, either a 30th or 31st, (or 28/29) , just do an extra copy of the file to the archive directory. There's no need to extra code to detect a month. change. Or am i misinterpreting what OP wants? Quote from: ghostdog74 on May 10, 2008, 04:15:48 AM

Read his post also, that his batch file copies files everyday.

Every working day, I should think, in view of this that he wrote:

Quote
did i mention that I don't work weekends ? Which means it is the 3rd before I am back to run the new months first file.

But it is ambiguous, so let's wait for him or her to clarify.Thanks for your replies - I'm okay to copy the last days file into the archive - I have a second 'EOM' batch file set up to do that.

However, If I go on vacation at month end/crossover my cover could easily just run the daily file and end up over-writing the month end file ....Not good news !!

I just wondered if I could somehow put the daily and EOM files together so that the super file could just be run - and it would sort out whether to continue saving to the 'current folder' or archive to the EOM folder before continuing.

I love you all
Trev

If this sort of thing is really mission-critical then you are being (I am sorry to be blunt) foolishly cheeseparing to do things this way, getting IT SUPPORT from a web forum. Budget for some IT support costs.
Dias de verano - You are right !!

Also your earlier solution will work perfectly - Many thanks for that - I was toying with something similar but couldn't get it to work - your solution avoids the problem I has neatly.

As for IT support ................. In our place ?? You are joking I'd be OLD and GREY before that happened !!

Look after yourself
and thanks also to everyone else who chipped in - we can call this one resolved.

Trev




Discussion

No Comment Found