Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Display Memory
Message
From
15/12/2003 15:20:30
 
 
To
15/12/2003 10:01:21
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00858707
Message ID:
00859257
Views:
24
Thanks for the code!

>Here's what we do in an older program. Before the program gets to this point, the user inserts a floppy disk (1.44mb) and if it has any existing files on it, the user is prompted to erase all files on it. If the user does not, then he/she is prompted to insert another floppy disk before continuing and the same check is performed, etc. An array is created that contains all files that will be copied to floppy. It sums up the space required for each file and checks to make sure there is enough space on the floppy disk before copying. Typically our files are so small that they all fit on one floppy. However, for your purpose, you could do something similar but try different combinations of the files listed in the array to determine how best to spread them unto floppy disks. Of course if a file is too big, it won't be able to be copied regardless.
>
>
>=ADIR(gaexpfiles,tdir+"*.csv")
>=ASORT(gaexpfiles)
>PRIVATE lntot, lctot
>lctot=""
>lntot=0
>FOR i = 1 TO ALEN(gaexpfiles,1)
>IF UPPER(TYPE('gaexpfiles(i,2)'))="N"
>   lctot=lctot;
>   +PADR(ALLTRIM(gaexpfiles(i,1)),25,'.');
>   +PADL(ALLTRIM(STR(gaexpfiles(i,2))),25,'.');
>   +CHR(13)
>   lntot=lntot+gaexpfiles(i,2)
>ENDIF
>ENDFOR
>lctot=lctot+'Total Free Space Required : '+ALLTRIM(STR(lntot))+CHR(13)
>lctot=lctot+'Space on your Floppy Drive: '+'1384576'+CHR(13)+CHR(13)
>PRIVATE tcfile
>IF lntot>1384576	&& not enough space on floppy drive to copy files
>   MESSAGEBOX(lctot;
>   +'Not enough space on floppy disk to copy files.'+CHR(13);
>   +'Click OK to Abort this Operation and Return'+CHR(13);
>   ,16, 'ERROR - Insufficient space on floppy drive.')
>   *do whatever you need to since you cannot copy to floppy
>ELSE	&& ok to copy to floppy drive
>   *Copy the file to the floppy
>ENDIF
>
>
Previous
Reply
Map
View

Click here to load this message in the networking platform