It works. Thank you.
How can I do this in a STAX job, I have some STAX code as follows, but it
complains that element content is invalid ... in <sameconsole>
<process>
<location>'local'</location>
<command>'xcopy'</command>
<parms>'%s\*.* %s\*.* /e /h ' % (scriptsfiles, , des_scriptfiles)</parms>
<sameconsole/>
<stderr mode="'stdout'"/>
<returnstdout/>
<wait/>
</process>
Please help.
Cindy
From: Sharon Lucas [mailto:luc...@us.ibm.com]
Sent: April-14-11 9:52 AM
To: Cindy Zhu
Cc: staf-users@lists.sourceforge.net
Subject: RE: FW: [staf-users] Delete a folder with subfolders and read-only
files
Specify the SAMECONSOLE option to resolve the problem. The xcopy command is
encountering the following problem described in section "8.12.2 START" in the
STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDRPROCSRV:
Notes:
1. On Windows systems, if you are redirecting stdin/out/err and are not using
SAMECONSOLE, it is recommended that you redirect all three input/output
streams. If one or two streams are redirected, but not all three, the
non-redirected streams will not be available to the application. For example,
if stdout and stderr are redirected, but not stdin, then the application will
receive errors if it tries to read from standard input. As another example, if
stdin and stdout are redirected, but not stderr, then you will not see any of
the standard error output displayed in the console window. This problem only
occurs when using NEWCONSOLE, which is the default. You may freely redirect any
combination of stdin, stdout, and stderr when using SAMECONSOLE. This problem
is due to a known limitation in the Windows API.
Your xcopy command does not require the destination to exist. I meant for you
to check if the source directory existed not the target. But now I know the
network drive is not the problem. The problem is because you need to add the
SAMECONSOLE option on your PROCESS START request. I verified this with the
following example:
C:\>xcopy g:\staf\test\*.txt c:\temp\test\*.txt /e /h
G:\staf\test\smallFile.txt
G:\staf\test\textfile.txt
2 File(s) copied
Running this xcopy request via a STAF PROCESS START request without the
SAMECONSOLE option does not copy any tiles (note that the file data doesn't
show the "2 File(s) copied" message):
C:\>STAF local PROCESS START SHELL COMMAND "xcopy g:\staf\test\*.txt
c:\temp\test\*.txt /e /h" RETURNSTDOUT STDERRTOSTDOUT WAIT
Response
--------
{
Return Code: 0
Key : <None>
Files : [
{
Return Code: 0
Data :
}
]
}
Running this xcopy request via a STAF PROCESS START request with the
SAMECONSOLE option works (note that the file data shows the "2 File(s) copied"
message):
C:\>STAF local PROCESS START SHELL COMMAND "xcopy g:\staf\test\*.txt
c:\temp\test\*.txt /e /h" SAMECONSOLE RETURNSTDOUT STDERRTOSTDOUT WAIT
Response
--------
{
Return Code: 0
Key : <None>
Files : [
{
Return Code: 0
Data : G:\staf\test\smallFile.txt
G:\staf\test\textfile.txt
2 File(s) copied
}
]
}
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Cindy Zhu <c...@fekete.com>
To: Sharon Lucas/Austin/IBM@IBMUS
Cc: "staf-users@lists.sourceforge.net" <staf-users@lists.sourceforge.net>
Date: 04/14/2011 10:29 AM
Subject: RE: FW: [staf-users] Delete a folder with subfolders and
read-only files
________________________________
J is a network drive. STAFProc in not a window service, it is started from a
command prompt.
No luck even try specifying the SHELL option.
"STAF local FS LIST DIRECTORY "D:/Temp/Silk/Apps/Harmony" failed. By the way,
when I use xcopy from STAF to copy files to a destination, does the destination
have to exist?
Thanks,
Cindy
From: Sharon Lucas [mailto:luc...@us.ibm.com]
Sent: April-13-11 4:49 PM
To: Cindy Zhu
Subject: Re: FW: [staf-users] Delete a folder with subfolders and read-only
files
Try specifying the SHELL option on the PROCESS START request.
Is J: a network drive not a local drive?
Does the following fail as well? STAF local FS LIST DIRECTORY
"D:/Temp/Silk/Apps/Harmony"
How are you starting STAFProc? If you're starting STAFProc as a Windows
service then STAFProc may not be able to access files on network drives. So,
try shutting down STAF and restarting it from a command prompt and retry the
PROCESS START request to see if that resolves the problem.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Cindy Zhu <c...@fekete.com>
To: Sharon Lucas/Austin/IBM@IBMUS
Date: 04/13/2011 05:31 PM
Subject: FW: [staf-users] Delete a folder with subfolders and read-only
files
________________________________
Sorry, there is a mistake in my previous email.
I know this DOS command "xcopy J:\Automation\Silk\Apps\Harmony\*.*
D:\Temp\Silk\Apps\Harmony\*.* /e /h" can remove the read-only attribute while
copying files on windows. I tried it and it worked for me.
But when I use STAF command "STAF local PROCESS START COMMAND "xcopy
J:\Automation\Silk\Apps\Harmony\*.* D:\Temp\Silk\Apps\Harmony\*.* /e /h"
RETURNSTDOUT STDERRTOSTDOUT WAIT", nothing was copied over and I got this error:
Response
------------
{
Return Code: 0
Key: <None>
Files: [
{
Return Code: 0
Data:0
}
]
}
Please help.
Thanks,
Cindy
From: Cindy Zhu
Sent: April-13-11 4:24 PM
To: 'Sharon Lucas'
Subject: RE: [staf-users] Delete a folder with subfolders and read-only files
I know this DOS command "xcopy J:\Automation\Silk\Apps\Harmony\*.*
D:\Temp\Silk\Apps\Harmony\*.* /e /h" can remove the read-only attribute while
copying files on windows. I tried it and it worked for me.
But when I use STAF command "STAF local PROCESS COMMAND "xcopy
J:\Automation\Silk\Apps\Harmony\*.* D:\Temp\Silk\Apps\Harmony\*.* /e /h"
RETURNSTDOUT STDERRTOSTDOUT WAIT", nothing was copied over and I got this error:
Response
------------
{
Return Code: 0
Key: <None>
Files: [
{
Return Code: 0
Data:0
}
]
}
Please help.
Thanks,
Cindy
From: Sharon Lucas [mailto:luc...@us.ibm.com]
Sent: April-13-11 2:48 PM
To: Cindy Zhu
Subject: RE: [staf-users] Delete a folder with subfolders and read-only files
An absolute path.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Cindy Zhu <c...@fekete.com>
To: Sharon Lucas/Austin/IBM@IBMUS
Date: 04/13/2011 03:47 PM
Subject: RE: [staf-users] Delete a folder with subfolders and read-only
files
________________________________
Hi Sharon,
"/tmp/myfiles" is relative path or absolute path?
Thanks,
Cindy
From: Sharon Lucas [mailto:luc...@us.ibm.com]
Sent: April-13-11 1:50 PM
To: Cindy Zhu
Cc: staf-users@lists.sourceforge.net
Subject: Re: [staf-users] Delete a folder with subfolders and read-only files
To delete a folder and all of its contents including subdirectories, you can
use the STAF FS service's DELETE ENTRY request with the RECURSE option. For
example:
STAF machine FS DELETE ENTRY /tmp/myfiles RECURSE CONFIRM
However, this won't delete any read-only files.
So, you could either change the permissions of any read-only files contained
within the directory so that they are not read only (e.g. using a STAF PROCESS
START request to run an OS command like chmod, etc) before using the STAF FS
DELETE request.
Or, you could run an OS command that allows you to delete read-only files. For
example, on Unix machines like Linux, you could use the "rm -Rf" command with
the Recursive and Force options to remove a directory and all of its contents
including subdirectories and read-only files. For example:
STAF machine PROCESS START SHELL COMMAND "rm -Rf /tmp/myfiles" RETURNSTDOUT
STDERRTOSTDOUT WAIT
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Cindy Zhu <c...@fekete.com>
To: "staf-users@lists.sourceforge.net" <staf-users@lists.sourceforge.net>
Date: 04/13/2011 02:32 PM
Subject: [staf-users] Delete a folder with subfolders and read-only files
________________________________
Hi,
How to delete a folder with subfolders and read-only files from STAF command?
Thanks,
Cindy
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization.
http://p.sf.net/sfu/vmware-sfdev2dev_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users