How to copy multiple file with fwh

How to copy multiple file with fwh

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

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

Postby lojze » Wed Jan 03, 2007 10:40 pm

Hey programers, no more idea???
Lojze
lojze
 
Posts: 4
Joined: Wed Jan 03, 2007 12:41 am

Re: How to copy multiple file with fwh

Postby Enrico Maria Giordano » Wed Jan 03, 2007 10:55 pm

Code: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 66 guests