COPY FILE issue
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
COPY FILE issue
Is there a way to copy a file that has a comma "," in the file name.
With COPY FILE &cSource TO &cDest I get a DOS Error 123.
I cannot control the original filename so I have to somehow work with the "," in the filename.
I will also need to be able to delete this file without generating an error.
With COPY FILE &cSource TO &cDest I get a DOS Error 123.
I cannot control the original filename so I have to somehow work with the "," in the filename.
I will also need to be able to delete this file without generating an error.
Thanks,
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
Re: COPY FILE issue
You might try
COPY FILE (cSource) TO (cDest)
or maybe
filecopy( cSource, cDest )
COPY FILE (cSource) TO (cDest)
or maybe
filecopy( cSource, cDest )
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: COPY FILE issue
I wonder if the error is in source or destination definition. Can you change the destination name to one without comma?
COPY FILE (cSource) TO ('test.tst')
If it can copy to normal filename without error then you might have a work around.
Maybe filemove( cSource, 'test.tst' )
COPY FILE (cSource) TO ('test.tst')
If it can copy to normal filename without error then you might have a work around.
Maybe filemove( cSource, 'test.tst' )
Re: COPY FILE issue
Jeff, I don't have xharbour available to test with but the following code works in harbour.
Robb
Code: Select all
procedure main()
local cSource := "te,st.prg"
local cTarget := cSource + ".bak"
if FileCopy( cSource, cTarget ) != 0
? "Copy okay"
else
? "Copy failed."
endif
return
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: COPY FILE issue
Thanks Robb ... unfortunately with xharbour I get "Copy Failed"
Thanks,
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
Re: COPY FILE issue
Code: Select all
static cTarget := "c:\Five"
function CopyFiles()
cTarget = AllTrim( cTarget )
if ! File( cTarget )
lMkDir( cTarget )
endif
LZCopyFile( "d:\Five\Five.lib", cTarget + "Five.lib" )
return nil
João Santos - São Paulo - Brasil
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: COPY FILE issue
Jeff
I know with Sql you can put things in brackets .. perhaps
Copy file ( "[Some,File]" ) to ( "[ Some,Where ]" ) .. untested .. just a shot in the dark.
Rick Lipkin
I know with Sql you can put things in brackets .. perhaps
Copy file ( "[Some,File]" ) to ( "[ Some,Where ]" ) .. untested .. just a shot in the dark.
Rick Lipkin
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: COPY FILE issue
This FWH function works with both xHarbour and HarbourJeff Barnes wrote:Is there a way to copy a file that has a comma "," in the file name.
With COPY FILE &cSource TO &cDest I get a DOS Error 123.
I cannot control the original filename so I have to somehow work with the "," in the filename.
I will also need to be able to delete this file without generating an error.
Code: Select all
? CopyFile( cSourceFile, cDestFile, 0 )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: COPY FILE issue
Thanks everyone. I got it working
Thanks,
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)