Yes, it will be in a servlet. but I use main function to
test it first. here is part of code:
if(!checkfile.existfile(dirName,fileName))
{
try
{
Runtime rt = Runtime.getRuntime();
String cmd = "copy d:\\files\\tmp\\" + fileName + " d:\\labfiles\\lab1\\.";
rt.exec(cmd);
}catch (Exception ex)
{
ex.printStackTrace();
}
}
copy process happens only if the same file doesn't exist in the target folder.
here is the exception:
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.<init>(Win32Process.java:66)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:551)
at java.lang.Runtime.exec(Runtime.java:418)
at java.lang.Runtime.exec(Runtime.java:361)
at java.lang.Runtime.exec(Runtime.java:325)
at CheckCopyFile.main(CheckCopyFile.java:15)
100% java code can do such task but it is sort of time-consuming.
Thanks.
Yongping
[This message has been edited by Yongping Wang (edited September 24, 2001).]