FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour COPY FILE issue
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
COPY FILE issue
Posted: Wed May 04, 2016 12:12 AM

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.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: COPY FILE issue
Posted: Wed May 04, 2016 03:38 AM

You might try
COPY FILE (cSource) TO (cDest)
or maybe
filecopy( cSource, cDest )

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: COPY FILE issue
Posted: Wed May 04, 2016 12:49 PM

Hi Gale,

Same error :(

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: COPY FILE issue
Posted: Wed May 04, 2016 02:37 PM

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' )

Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: COPY FILE issue
Posted: Wed May 04, 2016 03:11 PM
Jeff, I don't have xharbour available to test with but the following code works in harbour.

Code (fw): Select all Collapse
procedure main()

   local cSource := "te,st.prg"
   local cTarget := cSource + ".bak"

   if FileCopy( cSource, cTarget ) != 0
      ? "Copy okay"
   else
      ? "Copy failed."
   endif

   return


Robb
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: COPY FILE issue
Posted: Wed May 04, 2016 04:03 PM

Thanks Robb ... unfortunately with xharbour I get "Copy Failed" :(

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: COPY FILE issue
Posted: Wed May 04, 2016 06:06 PM
Code (fw): Select all Collapse
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 - Phone: +55(11)95150-7341
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: COPY FILE issue
Posted: Wed May 04, 2016 10:06 PM

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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: COPY FILE issue
Posted: Thu May 05, 2016 08:58 AM
Jeff 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.


This FWH function works with both xHarbour and Harbour
Code (fw): Select all Collapse
? CopyFile( cSourceFile, cDestFile, 0 )
Regards



G. N. Rao.

Hyderabad, India
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: COPY FILE issue
Posted: Thu May 05, 2016 05:30 PM

Thanks everyone. I got it working :)

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion