Reset errors in scripted operation

Advertisement

dcstar
Joined:
Posts:
3

Reset errors in scripted operation

Hello there, I have managed to successfully get a scripted job running, but I need to either have it ignore a possible error early in the script, or I need to be able to only capture errors later in the script.

I am creating a specific remote directory as part of the script - I don't really care if the directory already exists - but if the directory does exist, the resulting error returns an Errorlevel 1 when the script exits (it works fine if the directory doesn't exist).

I only want the Errorlevel 1 if subsequent file transfers fail!

It has to be this way as a separate process re-runs the script an hour later if it initially returned an error.

I think I can do a "workaround" by running two separate scripts, one to create the directory (without any error checking) and then one to do the transfers, but I'd rather have it all in one script for simplicity's sake.

I am using version 3.7.6 in a Windows XP environment.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,506
Location:
Prague, Czechia

Re: Reset errors in scripted operation

dcstar wrote:

I am creating a specific remote directory as part of the script - I don't really care if the directory already exists - but if the directory does exist, the resulting error returns an Errorlevel 1 when the script exits (it works fine if the directory doesn't exist).

I only want the Errorlevel 1 if subsequent file transfers fail!
The script should exit after error, only if you have "option batch abort" set. Do you? Then unset it before creating the directory, and reset it back afterwards:
...
option batch on
mkdir <path>
option batch abort
put ...

Reply with quote

dcstar
Joined:
Posts:
3

Re: Reset errors in scripted operation

martin wrote:

dcstar wrote:

I am creating a specific remote directory as part of the script - I don't really care if the directory already exists - but if the directory does exist, the resulting error returns an Errorlevel 1 when the script exits (it works fine if the directory doesn't exist).

I only want the Errorlevel 1 if subsequent file transfers fail!
The script should exit after error, only if you have "option batch abort" set. Do you? Then unset it before creating the directory, and reset it back afterwards:
...
option batch on
mkdir <path>
option batch abort
put ...
The issue isn't the script exiting with the abort option, the issue is when the script ends after successful file transfers, a previous mkdir failure returns errorlevel 1.

I had hoped that using additional "option abort" commands would reset the returned errorlevel in the script back to 0, but this doesn't seem to occur.

Reply with quote

dcstar

No worries, I have gone in the dual scripts direction (though it would be nice to have a feature in the next version to reset the errorlevel..........) :wink:

Reply with quote

Advertisement

You can post new topics in this forum