Page 1 of 1

How to copy multiple file with fwh

Posted: Wed Jan 03, 2007 12:52 am
by lojze
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

Posted: Wed Jan 03, 2007 2:01 am
by lojze
FUNCT KOPIRAJ(KAJ,KAM)

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

RETURN .T.


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

** work ok!

Posted: Wed Jan 03, 2007 10:40 pm
by lojze
Hey programers, no more idea???

Re: How to copy multiple file with fwh

Posted: Wed Jan 03, 2007 10:55 pm
by Enrico Maria Giordano

Code: Select all

#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

Posted: Sat Jan 06, 2007 12:52 am
by lojze
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.