How to copy multiple file with fwh

Post Reply
lojze
Posts: 4
Joined: Wed Jan 03, 2007 12:41 am

How to copy multiple file with fwh

Post 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
Lojze
lojze
Posts: 4
Joined: Wed Jan 03, 2007 12:41 am

Post 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!
Lojze
lojze
Posts: 4
Joined: Wed Jan 03, 2007 12:41 am

Post by lojze »

Hey programers, no more idea???
Lojze
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: How to copy multiple file with fwh

Post 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
lojze
Posts: 4
Joined: Wed Jan 03, 2007 12:41 am

Post 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.
Lojze
Post Reply