Best practices for resuming a script

Viewed 65

I have a script that processes a couple of thousand files and copies the files individual users folders. This process takes some time as it checks for proper security on each folder and if the user associated with the file still has a valid account. Because this takes time, there has been instances where the script was closed inadvertently while it was in the middle of processing.

Has anyone come up with a method to check if the script did not finish completely and if so continue processing where it left off?

I was thinking to add a check for a file at the start of the script and if it doesn't exist create the file. The last part of the script would remove the file. That way if the script was closed without finishing the file would exist on the next run and it would 'know' to continue.

I'm just looking for advice on any method that would be better that this.

0 Answers
Related