COPY FILE issue

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

COPY FILE issue

Post by Jeff Barnes »

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 12.01, xHarbour 1.2.1, Bcc582)
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Re: COPY FILE issue

Post by Gale FORd »

You might try
COPY FILE (cSource) TO (cDest)
or maybe
filecopy( cSource, cDest )
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: COPY FILE issue

Post by Jeff Barnes »

Hi Gale,

Same error :(
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Re: COPY FILE issue

Post by Gale FORd »

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' )
User avatar
rhlawek
Posts: 165
Joined: Sun Jul 22, 2012 7:01 pm

Re: COPY FILE issue

Post by rhlawek »

Jeff, I don't have xharbour available to test with but the following code works in harbour.

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
 
Robb
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: COPY FILE issue

Post by Jeff Barnes »

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

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: COPY FILE issue

Post by karinha »

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
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: COPY FILE issue

Post by Rick Lipkin »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: COPY FILE issue

Post by nageswaragunupudi »

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: Select all

? CopyFile( cSourceFile, cDestFile, 0 )
Regards

G. N. Rao.
Hyderabad, India
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: COPY FILE issue

Post by Jeff Barnes »

Thanks everyone. I got it working :)
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
Post Reply