PDA

View Full Version : coping the folder from default location ?



rajroshan
12-22-2001, 05:15 AM
Hi Buddies and Gurues !!
I want to copy some folders from Source to target directory using XCopyFile (szSrcFile, szTargetPath, nOp) function .... it is working very fine . Say ,i have Folder namely MyFolder and it is to be copied into traget directory say C:\Me\Come\MyDir ...

I want the MyFolder to be picked up from any drive say D,E,.....
and copied into the target directory . Drive name should be picked up dynamically . How could it possible , anybody have idea ? i have written a code but it is not working , could any one tell me the problem in the code ? here is the code

drive="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
i=0;
while (drive[i]!="Z")
StrSub (alpha, drive, i, 1);
svPath=alpha+":\\folder\\";
if (ExistsDir (svPath) = EXISTS) then
drive=drive^":";
GetDisk (svPath, drive);
goto GOT;
endif;

i++;
endwhile;
GOT:

svPath1=drive^"\\MyFolder";
szDir1 ="C:\Me\Come\MyDir";

SRCDIR = svPath1;
TARGETDIR=szDir1 ^"\\";

res1=XCopyFile("*.*","*.*",INCLUDE_SUBDIR);
SetStatusWindow(20,"Folder one coping....");
SetStatusWindow(80," Folder one coping....");
SetStatusWindow(100,"Folder one coping.....");

code ends here .....



if i give the hard code drive name for source directory then only it works .. help me !!

your support would be highly appreciated

regards

Heba aly
12-25-2001, 09:23 AM
why don't you use the "GetDisk" function .