Is there any special magic to getting "SysFileCopy()" to work on Windows Vista
SP2? (The REXX version is ooRexx version 3.2.)
I am writing a REXX program to manage files. Its uses "SysFileTree()" to list
relevant files in a directory, then "SysFileMove()" on those files to rename
them, then "SysSetFileDateTime()" to set their date/time values appropriately,
and finally "SysFileCopy()" to copy them to their various final directories.
All of those functions work correctly EXCEPT for "SysFileCopy()", which gives
return code 5 for all files.
I am not sure but I think that return code 5 is "access denied", but I cannot
see why that should be. There is only one userid on the system (me), and I
have administrator privileges. And the file name and date/time changes work
OK.
I finally changed the REXX program and replaced "SysFileCopy()" with the
operating system's COPY command, and that DOES work OK (no "access denied"),
but I am curious as to why "SysFileCopy()" fails. Has anyone encountered this
problem before and found the solution? Thanks.
-- from CyberSimian in the UK
|
|
0
|
|
|
|
Reply
|
CyberSimian3 (13)
|
11/17/2009 3:45:04 PM |
|
CyberSimian wrote:
> Is there any special magic to getting "SysFileCopy()" to work on Windows
> Vista SP2? (The REXX version is ooRexx version 3.2.)
I have identified the problem, and it turns out that it was a user error (yes,
really!). For the benefit of anyone else who may have this problem, here are
the details.
In writing my REXX program, I had implicitly assumed that "SysFileCopy()" had
syntax similar to the operating system's COPY command. Initially I tried the
equivalent of:
rc=SysFileCopy("C:\dir1\name.ext","D:\dir2\*.*")
but that gave return code 123. Reading the manual showed that wild characters
were not valid, so then I tried:
rc=SysFileCopy("C:\dir1\name.ext","D:\dir2")
but this was the version that gave return code 5 ("access denied"). Both of
the above forms are valid on the COPY command, but neither is valid for
"SysFileCopy()". The syntax that is required is:
rc=SysFileCopy("C:\dir1\name.ext","D:\dir2\name.ext")
i.e. the "name.ext" of the destination must be specified explicitly.
-- from CyberSimian in the UK
|
|
0
|
|
|
|
Reply
|
CyberSimian
|
11/20/2009 3:09:26 PM
|
|
Did it work ok on a previous version of Windows?
Les (Change Arabic to Roman to email me)
CyberSimian wrote:
> CyberSimian wrote:
>> Is there any special magic to getting "SysFileCopy()" to work on Windows
>> Vista SP2? (The REXX version is ooRexx version 3.2.)
>
> I have identified the problem, and it turns out that it was a user error (yes,
> really!). For the benefit of anyone else who may have this problem, here are
> the details.
>
> In writing my REXX program, I had implicitly assumed that "SysFileCopy()" had
> syntax similar to the operating system's COPY command. Initially I tried the
> equivalent of:
>
> rc=SysFileCopy("C:\dir1\name.ext","D:\dir2\*.*")
>
> but that gave return code 123. Reading the manual showed that wild characters
> were not valid, so then I tried:
>
> rc=SysFileCopy("C:\dir1\name.ext","D:\dir2")
>
> but this was the version that gave return code 5 ("access denied"). Both of
> the above forms are valid on the COPY command, but neither is valid for
> "SysFileCopy()". The syntax that is required is:
>
> rc=SysFileCopy("C:\dir1\name.ext","D:\dir2\name.ext")
>
> i.e. the "name.ext" of the destination must be specified explicitly.
>
> -- from CyberSimian in the UK
>
>
|
|
0
|
|
|
|
Reply
|
LesK
|
11/20/2009 5:21:07 PM
|
|
CyberSimian wrote:
> rc=SysFileCopy("C:\dir1\name.ext","D:\dir2")
>
> but this was the version that gave return code 5 ("access denied"). Both of
> the above forms are valid on the COPY command, but neither is valid for
> "SysFileCopy()". The syntax that is required is:
>
> rc=SysFileCopy("C:\dir1\name.ext","D:\dir2\name.ext")
>
> i.e. the "name.ext" of the destination must be specified explicitly.
I wonder if:
rc=SysFileCopy("C:\dir1\name.ext","D:\dir2\")
�would work? Without the trailing '\' you are trying to copy to the file
named "D:\dir2" but that already exists, and is a directory.
--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
|
|
0
|
|
|
|
Reply
|
Swifty
|
11/21/2009 7:53:47 AM
|
|
LesK wrote:
> Did it work ok on a previous version of Windows?
I encountered the problem on Windows Vista SP2, but I have just run the test
program below on Windows XP SP3, and it gives the same result as Vista. But
note: this is for ooRexx version 3.2, not the current 4.0 (which, sadly, does
not work with the version of Blair Thompson's X editor that I use).
Swifty wrote:
> I wonder if:
> rc=SysFileCopy("C:\dir1\name.ext","D:\dir2\")
> .would work? Without the trailing '\' you are trying to copy to the file
> named "D:\dir2" but that already exists, and is a directory.
------------- test program --------------
/* copytest.rex */
rc=rxfuncadd('SysFileCopy','RexxUtil','SysFileCopy')
infile ='e:\test\rexx\test.dat'
outfile1='e:\test\rexx\test\*.*'
outfile2='e:\test\rexx\test'
outfile3='e:\test\rexx\test\'
outfile4='e:\test\rexx\test\test.dat'
rc=SysFileCopy(infile,outfile1)
say left('rc='rc,6)' for outfile="'outfile1'"'
rc=SysFileCopy(infile,outfile2)
say left('rc='rc,6)' for outfile="'outfile2'"'
rc=SysFileCopy(infile,outfile3)
say left('rc='rc,6)' for outfile="'outfile3'"'
rc=SysFileCopy(infile,outfile4)
say left('rc='rc,6)' for outfile="'outfile4'"'
------------ console output ---------------
"E:\test\rexx\copytest.rex"
rc=123 for outfile="e:\test\rexx\test\*.*"
rc=5 for outfile="e:\test\rexx\test"
rc=3 for outfile="e:\test\rexx\test\"
rc=0 for outfile="e:\test\rexx\test\test.dat"
------------------------------------------
So the answer is "no" -- ending the path with "\" is not valid for
"SysFileCopy()".
By the way, why isn't there a "SysFileRename()" function? I know that on
Windows "SysFileMove()" performs the same function, but only "old lags" like
us would know that. The occasional programmer that was the intended user
group for REXX would never figure that out. And what function is used on
Linux to rename a file (since "SysFileMove()" is Windows only)?
-- from CyberSimian in the UK
|
|
0
|
|
|
|
Reply
|
CyberSimian
|
11/21/2009 11:05:50 AM
|
|
|
4 Replies
239 Views
(page loaded in 0.092 seconds)
Similiar Articles:7/8/2012 4:35:56 PM
|