Originally Posted By: NTDOC
Well unless it is bad editing on your part the script HAS to fail.


PHP:
$REPORTUSER = domain1user $ARCHIVEUSER = domain2user $REPORTDRIVE = I: $ARCHIVEDRIVE = J:


Those vars need to be within quotes

The drive mappings have been working perfectly fine without using the quote marks up to this point. It is one reason I commented out the drive deletions in the END section so I can see what is being done when it fails.
Originally Posted By: NTDOC
I would also HIGHLY recommend that you place this type of header at the top of your script. It will force you to make sure you code cleanly.

PHP:
If Not @LogonMode Break On Else Break Off EndIf Dim $SO $SO=SetOption('Explicit','On') $SO=SetOption('NoVarsInStrings','On') $SO=SetOption('NoMacrosInStrings','On') $SO=SetOption('WrapAtEOL','On')


Again, bad editing????

Code:
$USERPASS = password


Unless you REALLY have to, I would recode the script so that you don't keep issuing the WriteLine over and over. I would attempt to write the log one time when needed only with a single write.

I am using it for now so I can trouble shoot at what stage the script would fail providing there were no parsing errors, which currently there are. I shall consider moving the writeline events at a later stage once I know the script runs through with no errors. At the moment, it is part of my own error checking. As for the $USERPASS, no, this was for removing identifiable. Any testing I am doing is running as a locally logged on user as the user who runs the script(in the scheduled task) won't have the ability to logon to the machine, only to run the scheduled task.

Originally Posted By: NTDOC
You use a USE statement without checking if the drive is already mapped or not. You should check and verify.

You attempt to use NoVarsInStrings and then you go and do this:

Code:
MD "$ARCHIVEDRIVE\@YEAR@MONTHNO@MDAYNO"

I'll go back and review checking the drive mappings, thanks for the suggestion.

My original post in this thread was about why MD creates the directory how I wanted it created, yet pre-defining $ARCHIVE works differently, even through we are dealing with KiX internal commands and macros. The suggestions I've been given only gave a work around, and no reason why they seems to be dealt with differently, so I'm working only on what I know.

Originally Posted By: NTDOC
You're using GOTO END I would really recode and remove all GOTO statements.

You attempt to remove a file/dir without checking if it exists or if you're even in the correct path/location. Very easy to delete or RD an entire structure if LEN is not correct. i.e. You can start an RD from the root of a drive which will give you the opportunity to rebuild the system if something like that happens.

Please take a crack at making the suggested changes and let us know how it goes please.

What would you suggest to use instead of GOTO statements. If there is a failure in one section I don't want the entire script to continue running when I know it will fail.

I could move the failure condition commands to the a seperate section called FAIL to recode reused code, which would include the WRITELINE commands, but once again, this would require GOTO, unless there is a more elegant way to deal with this. I wouldn't say I am a great scripter, but this is all I know at the moment.

I have taken your comments on board about RD, but I've been told that the files, etc I have to move are a series of files, directories and subdirectories, and are dymanic, so this is the best way I can see of dealing with it, mapping to the root of the store, so using RD won't remove anything above this level, and I do have to remove all contents of the "dump" directory.

Should I use a variation of the DIR command for this instead? I don't know how this deals with directories and subdirectories as I've never used it, and only seen it referenced briefly in the forums,

Pax