>I am using COPY TO command copy a file with a long file name which
>containing space from a windows XP to a Windows 2003 Server. Originally the
>file name is in large capitalize. But after copy to the 2003 server, the
>file name becomes small captialize.
>
>What's wrong ? And how can I control the captalization of the file name.
I ran into this problem with the VFP md command. When creating
more than one level of directory in one command, the names became
lower case. I found that by creating the directories one level at a
time, I was able to bypass this problem.
Suppose that directory A does not exist.
md A\SIMPLE\EXAMPLE
would have the problem, but
md A
md A\SIMPLE
md A\SIMPLE\EXAMPLE
would not.
Note that if A\SIMPLE existed,
md A\SIMPLE\EXAMPLE
would not have the problem. It is only when more than one level is
created in a command.
How are you creating the directories? (copy to does not create
directories.) Either you omitted mentioning your md command, or you
are using another way to create the directories. If the latter, I
think that this might not be a bug in VFP, but rather in the directory
creation function.
Perhaps, the following code of mine will be of use.
Following is the md replacement I worked out. You may have to
adjust the error handling, but I have included my code for that, too.
The app-level error handler simply stuffs various values associated
with errors in global variables for the app (in this case, mdnoerr())
to interrogate.
***** Start of md Replacement Code *****
* mdnoerr
* md with No Error if Directory Already Exists
* Last Modification: 2008-02-07
*
* Warning: Multi-level directory creation in one command works. e.g.
md \a\b
* will create both directories, but, apparently, if more than one
level of
* directories does not already exist, the directory names are created
in
* lower case regardless of the specified case. Because of this bug,
this
* procedure creates the directories one level at a time.
procedure mdnoerr
lparameters;
thedir && C: directory to create
local which, where, saveerrh
* Where to start md'ing
do case
* Volume share, as in
* \\server\sharename
* \\server\sharename\dir1\dir2
* Skip md'ing on
* \\server\sharename\
case left(thedir,2)="\\"
which=5
* Rooted path, as in
* c:\cbs2
* c:\cbs2\dir1\dir2
* Skip md'ing on
* c:\cbs2\
case isalpha(thedir) and substr(thedir,2,2)=":\"
which=2
* Non-rooted path, as in
* c:middle
* c:middle\sub2
* middle
* middle\sub2
* No skipping.
otherwise
which=1
endcase
* Add a trailing backslash (which will be trimmed off) when
creating the
* last directory).
if right(thedir,1)#"\"
thedir=thedir+"\"
endif
where=at("\",thedir,which)
do while where>0
saveerrh=on("error")
setupapperrh()
md (left(thedir,where-1))
on error &saveerrh
do case
case syserrno=1961
* 1961: A directory or file already exists.: ignore.
case syserrno#0
error syserrno && Rethrow any other error.
otherwise
* No error: do nothing.
endcase
which=which+1
where=at("\",thedir,which)
enddo
return
endproc
***** End of md Replacement Code *****
***** Start of Error Handler Variable Setup Code *****
* Allocate variables for app-level error handling.
private syserrno
private syserrmsg, syserr2018, syserrlineno, syserrlineno1
syserrno=0
syserrmsg=""
syserr2018=""
syserrlineno=0
syserrlineno1=0
***** End of Error Handler Variable Setup Code *****
***** Start of Error Handler Code *****
* setupapperrh
* Setup Error Handler for App-Level Code
* Last Modification: 2007-05-02
procedure setupapperrh
syserrno=0
syserrmsg=""
&& Kludge: This is to make sure that a spurious error code of 1 is
not
&& generated by apperrh()'s kludge. Since apperrh() will likely be
called
&& only for individual statements and then the error handling
reset, this
&& is fairly (but not totally) safe.
on error apperrh(error(),message(),sys(2018),lineno(),lineno(1))
return
endproc
* apperrh
* Error Handler for App-Level Code
* Last Modification: 2007-05-02
procedure apperrh
lparameters perror, pmessage, psys2018, plineno, plineno1
syserrno=perror
syserrmsg=pmessage
syserr2018=psys2018
syserrlineno=plineno
syserrlineno1=plineno1
* Kludge: Sometimes, error()=0 when a file does not exist, yet
message()
* is set correctly!
if syserrno=0 and !empty(syserrmsg)
syserrno=1
endif
return
endproc
***** End of Error Handler Code *****
Sincerely,
Gene Wirchenko
Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.
> Hi All
>
[quoted text clipped - 4 lines]
>
> What's wrong ? And how can I control the captalization of the file name.
I'm showing a couple of different ways how it can be done at
http://www.berezniker.com/content/pages/visual-foxpro/copy-move-rename-file-pres
erving-destination-name-case

Signature
--sb--
VFP MVP