COPY FILE issue

COPY FILE issue

Postby Jeff Barnes » 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)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: COPY FILE issue

Postby Gale FORd » Wed May 04, 2016 3:38 am

You might try
COPY FILE (cSource) TO (cDest)
or maybe
filecopy( cSource, cDest )
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: COPY FILE issue

Postby Jeff Barnes » Wed May 04, 2016 12:49 pm

Hi Gale,

Same error :(
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: COPY FILE issue

Postby Gale FORd » Wed May 04, 2016 2: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' )
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: COPY FILE issue

Postby rhlawek » Wed May 04, 2016 3:11 pm

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

Code: Select all  Expand view

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
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: COPY FILE issue

Postby Jeff Barnes » Wed May 04, 2016 4:03 pm

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

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: COPY FILE issue

Postby karinha » Wed May 04, 2016 6:06 pm

Code: Select all  Expand view

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
User avatar
karinha
 
Posts: 7814
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: COPY FILE issue

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

Re: COPY FILE issue

Postby nageswaragunupudi » Thu May 05, 2016 8: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: Select all  Expand view
? CopyFile( cSourceFile, cDestFile, 0 )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: COPY FILE issue

Postby Jeff Barnes » Thu May 05, 2016 5:30 pm

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

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 85 guests