FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to copy multiple file with fwh
Posts: 4
Joined: Wed Jan 03, 2007 12:41 AM
How to copy multiple file with fwh
Posted: Wed Jan 03, 2007 12:52 AM

I use fwh+harbour and need to copy files inside my app.
I try to do on this way , not work:

copy file "c:*.dbf " to "d:*.dbf"

not work?!
need help urgent!
thanks a lot

Lojze
Posts: 4
Joined: Wed Jan 03, 2007 12:41 AM
How to copy multiple file with fwh
Posted: Wed Jan 03, 2007 02:01 AM

FUNCT KOPIRAJ(KAJ,KAM)

WAITRUN("XCOPY "+KAJ +" " +KAM )

RETURN .T.

Use in source:
lMkDir( d:\bck)
kopiraj("c:*.dbf", "d:\bck")

** work ok!

Lojze
Posts: 4
Joined: Wed Jan 03, 2007 12:41 AM
How to copy multiple file with fwh
Posted: Wed Jan 03, 2007 10:40 PM

Hey programers, no more idea???

Lojze
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: How to copy multiple file with fwh
Posted: Wed Jan 03, 2007 10:55 PM
#include "Directry.ch"


FUNCTION MAIN()

    LOCAL aDir := DIRECTORY( "*.dbf" )

    LOCAL i

    FOR i = 1 TO LEN( aDir )
        COPY FILE ( "c:\" + aDir[ i, F_NAME ] ) TO ( "d:\" + aDir[ i, F_NAME ] )
    NEXT

    RETURN NIL


EMG
Posts: 4
Joined: Wed Jan 03, 2007 12:41 AM
How to copy multiple file with fwh
Posted: Sat Jan 06, 2007 12:52 AM

Enrico , you are right!
Here is another sample for deleting several file, also work fast

DeleteFiles("c:\myapp\" , "*.ppo")

Funct DeleteFiles(FromWhere,WhatFiles)
local Curdir:= CurDrive()+":\"+CURDIR()+"\"
lChDir(FromWhere) // Ferase work on current dir, so change dir

aFiles := Directory(FromWhere +WhatFiles)
Aeval(aFiles, {|v| Ferase( v[1]) })

lChDir(CurDir) // go back to mydir

Return .t.

Lojze

Continue the discussion