PDA

View Full Version : copy local file



Unregistered
10-19-2011, 08:14 AM
hello,
the "copy file" dosnt support unc path
can i fix it?

linder
10-19-2011, 08:23 AM
Hello,

"Copy File(s)..." work fine with UNC paths. The copy file functionality is just a wrapper around the CopyFile Windows API.

I tested the following:

Copy File(s) from "e:\test\HP0011.jpg" to "\\Win7-64\corpdata"
Display Message Box "%_SB_ERRORCODE%" -- ""

It copied the file HP0011.jpg from e:\test to \\Win7-64\corpdata and the returned %_SB_ERRORCODE% value was is nonzero.

Does this help?

Friedrich

Unregistered
10-19-2011, 08:29 AM
no - in my enviroment this dosnt work
copy file from %SERVER_DIR%\progi.exe to %LOCAL_DIR%

server_dir="\\testpc\progi"
local_dir="c:\temp\test"

wen i change the server_dir to "c:\dummy" the copy file works fine


Hello,
Does this help?

Friedrich

linder
10-19-2011, 08:41 AM
It works fine. I changed the test code to the following:

Set Variable %SERVER_DIR% to "\\Win7-64\corpdata"
Set Variable %LOCAL_DIR% to "e:\test"

Copy File(s) from "%LOCAL_DIR%\HP0011.jpg" to "%SERVER_DIR%"
Display Message Box "%_SB_ERRORCODE%" -- ""

Delete Files "%LOCAL_DIR%\HP0011.jpg"

Copy File(s) from "%SERVER_DIR%\HP0011.jpg" to "%LOCAL_DIR%"
Display Message Box "%_SB_ERRORCODE%" -- ""

It copied the file HP0011.jpg from e:\test to \\Win7-64\corpdata, then deleted the original e:\test\HP0011.jpg and copied it back from "\\Win7-64\corpdata\HP0011.jpg" to "e:\test"

Friedrich

linder
10-19-2011, 09:07 AM
BTW, just for fun, you can call the CopyFileA Windows API directly (see attached screenshot) to copy the file from your UNC path.

You can then check the GetLastError Windows API return code to see what is going wrong in your environment.

The error codes are listed here:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx

Does this help? If you are interested, I can send you my test project.

Friedrich