[<<]Message[>>]    [<<]Author[>>]    [<<]Subject        [<<]Thread    

Number : 4024 Date : 2003-03-11 Author : Garry Deane Subject : Re: Digest Number 593 Size(KB) : 2
--- In xxcopy@yahoogroups.com, Jon Hugdahl wrote: > I went to the link below. There is also a getvar command. > A simple (not elegant) idea to use for setting a return code > from xxcopy. See the link. =20 Just in case others (like me) were a little confused by Jon's post,=20 let me expand. Jon was referring to xxcopy having the ability to set=20 environment variables when it executes to indicate the status of the=20 xxcopy operations. Currently xxcopy sets the exit code (a number=20 between 0 and 255 which is tested using "if errorlevel =85.") but has=20 no other mechanism to pass information back to a calling program or=20 batch file. Information which might be useful could be the source or destination=20 directory or the log file name where this is created using a macro,=20 the number of files copied, skipped or failed and of course the exit=20 code itself. While it is relatively easy in NT/W2k/XP to scan the screen or log=20 file output to extract this information, it is somewhat harder to do=20 this in DOS/W9x/ME. Jon is suggesting that an easy way to do this is=20 to instruct xxcopy to write a small batch file which will issue SET=20 commands to set the appropriate environment variables. The advantage=20 of this method is that it will work irrespective of the operating=20 system used. Say for example that the following variables are implemented (to name=20 but a few possibilities): xx_all <=3D output all variables xx_error <=3D exit code xx_copy <=3D number of files copied xx_skips <=3D number of files skipped xx_fails <=3D number of failed file copies xx_src <=3D name of source base directory xx_dst <=3D name of destination directory xx_log <=3D name of log file You could have a few more xxcopy switches (as if that is needed)=20 which are say: /oBF:filename.bat /oB:param1:param2:paramN then issue a command like: xxcopy /oN:/$date$.log /oBF:xxstatus.bat /oB:xx_error:xx_fails:xx_log This would cause xxcopy to create a file called xxstatus.bat which=20 contained: set xx_error=3D105 set xx_fails=3D5 set xx_log=3DD:\temp\0311.log This file can then be CALLed after the xxcopy command and tests=20 carried out against the values set. As an NT/W2k user, I don't have much need for this sort of mechanism=20 but possibly others may have a use for it. Garry
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.