Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create folder and copy data into it
Message
From
28/09/2004 03:56:45
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00946159
Message ID:
00946562
Views:
31
My dear Professor

Thanks for helping me. Now no error message appears, but sir my actual problem still not solve. The detail is under

I have a folder as D:\Cotton. This folder has some sub folders such as FORMS, REPORTS, TABLES etc. I want to copy all of the sub folders, complete directory d:\cotton to c:\cotton, to new folder so in the beginning I use following lines
cFolder1 = "d:\cotton\"
cFolder2 = "c:\cotton"
cfiles = cFolder1+"*.*"
Now sub folders do not copy to c:\cotton.
Complete codes are below dotted line.

What is wrong pleae modify and help again.

Thanks in advance

*------------------------------------

set safety off

cFolder1 = "d:\cotton\"
cFolder2 = "c:\cotton"
cfiles = cFolder1+"*.*"


DECLARE INTEGER CreateDirectory IN kernel32;
STRING lpPathName, INTEGER lpSecurityAttr

IF !DIRECTORY(cfolder2)
IF CreateDirectory (cFolder2, 0) = 0
=MESSAGEBOX('Could not create '+cfolder2)
RETURN
ENDIF
IF !DIRECTORY(cfolder2)
=MESSAGEBOX('Could not create '+cfolder2)
RETURN
ENDIF
ENDIF

IF ADIR(allfiles,cfiles) > 0 && Check If ADIR returns some files

DECLARE INTEGER CopyFile IN kernel32;
STRING lpExistingFileName,;
STRING lpNewFileName,;
INTEGER bFailIfExists

FOR i = 1 TO ALEN(allfiles,1)
=CopyFile(cfolder1+allfiles(i,1), cfolder2+"\"+allfiles(i,1), 0)
ENDFOR
ENDIF
*return

messagebox("DONE")
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform