Dec 252017
 
Fit files onto floppies using the least number. A nice handy program to have when you need to pack floppies.
File FFIT16.ZIP from The Programmer’s Corner in
Category Utilities for DOS and Windows Machines
Fit files onto floppies using the least number. A nice handy program to have when you need to pack floppies.
File Name File Size Zip Size Zip Type
FFIT.DOC 17562 6222 deflated
FFIT.EXE 55614 33173 deflated

Download File FFIT16.ZIP Here

Contents of the FFIT.DOC file




FFIT ver 1.6, October 1992 by Kai Risku
=======================================

This program was made to help you copy files to disks, without having to
think about how to group the files so they will take up the least number
of disks. This problem is often referred to as the 'The Knapsack
Problem'. FFIT checks the size of the disks you are going to copy to
and then combines the files so they will fill the disks optimally. After
this, the program will copy the files to the disks prompting you for
each disk.

Several options are available to modify the way FFIT works. You can
specify alphabetical sorting, no grouping (sequential copying), wanted
volume size, how much space you want to leave free on the disks, only
use files with archive bit set, test mode (just print the filenames, do
not copy), and much more. 4DOS/NDOS file descriptions are also handled.

Please note that the sorting may take a while, so be patient when using
this program. Also note that since this program copies everything to the
root of the target disks, there is a limit to how many files can be
placed there. As an example can be said that on a 1.44 Mb diskette you
can have 224 files in the root directory. This program will not check
the maximum number of files that may be placed in the root directory.
Therefore you might get an 'Error copying file' if the program tries to
copy too many files to one disk.


Ok, how do I use this wonderful program..
=========================================

Syntax: FFIT [options] [filespecs..] [@listfile] target:

The target drive must be a removable medium. Arguments may appear in any
order. An argument starting with '-' or '/' is interpreted as an option.
The filespec can be one or more directories or filenames with or without
wildcards. You can also put all desired directories or filenames (each
on a separate line) in an ordinary textfile and specify '@filename' as
the filespec.

FFIT is fully compatible with 4DOS/NDOS file descriptions.
When using FFIT all descriptions will be dealt with automagically.

The following options can be used:


-a add
===============

Use the space available on the disk. If this option is NOT
specified, the program will use the whole capacity of the disk, and
thus require totally empty disks (non-empty disks will be erased
after prompting the user for permission).

You MUST use this option if you want to to add files to a disk where
there are already some files! If the -a option is given, the program
cannot say how many disks will be required, as this depends on the
space available. Without this option the program will say how many
disks is needed before the copying begins.


-b sort big files first
================================

If you specify this option all files will be sorted according to
size, biggest first. By using this option, the disks can get a
little bit better filled. If you are fitting to many disks, the
difference between using this option or not, usually means that the
second last disk might not be perfectly filled.

The drawback of using this option is that because all big files are
sorted first, the last disks are filled with lots of small files. Do
not use this option if you want your files evenly spread among the
disks.


-c archive bits
========================

Copy only files with the archive bit set. The archive bit will be
reset after the file has been copied. This could be useful if you
have lots of files but only a limited number of disks and you are
not able to copy all files at once. Set the archive bit on all files
and then use this option. At a later time you can restart FFIT and
copy the files that has not already been copied.


-d n start with disk number n
====================================

This is useful if you have aborted the program and wish to continue
from a given disk. The space between d and the number can be left
out. This option cannot be used together with option -a.


-f force
=================

No prompting for permission will be done. Normally the program will
ask when you are about to erase a disk, overwrite files or if there
are read-only files that are about to be erased, but with this
option given no questions will be asked. Could be dangerous!


-m move
================

After a disk has been successfully copied, the source files will be
deleted. You will be asked to confirm every read-only file unless
option -f is given.


-n no grouping
=======================

The files will be copied in the same order as specified, one at a
time and requesting a new disk when the next file won't fit.


-q quiet
=================

Just a silly little option to generate absolutely quiet beeps.


-s sort alphabetical
=============================

The files will be copied in alphabetical order to the disks.
Normally this will just result in a nicer directory listing, but if
used together with the option -n, all filenames will be globally
sorted.


-t [size] test mode
=====================

Do not write or delete anything, just simulate and print all texts
as they would otherwise appear. This is very useful if you want to
know in advance which files will go on which disks.

You may also specify an optional argument. This argument must then
be one of the following: 160, 180, 320, 360, 720, 120, 144. Normally
FFIT will always examine the target disk to see what capacity it is,
but by using this argument you can set a disksize to use. In this
case you do not need to have a disk in the target drive, which could
come in handy when you just want to test. In this case the target
drive can be omitted from the command line.


-u uppercase
=====================

Print all filenames in UPPERCASE. This has only aesthetical value
and will make very loud filenames.


-v size volume size
=======================

Fit files to the specified volume size. The numeric argument can be
suffixed with 'k' or 'M', meaning kilo (times 1024) or Mega (times
1024*1024). You can also use a decimal point, as in 1.2M which then
means 1.2*1024*1024 bytes.

If the specified size is negative, that much free space will be left
on each disks. The space between v and size can be left out.


Options can be combined, and several options can also be specified after
the same '-' or '/'. The only exception is that no more options can be
combined after a numeric argument. In that case you must start with a
new '-' or '/'.

Example: If you want to give the options add, sort, start with
disk number 3 and test mode, all the following is legal:
-a -s -d3 -t
/astd3
-as -d 3 -t
But you cannot use: -asd3t since you cannot place any
option characters immediately after the '3'.


You can specify as many filenames you wish, and they may contain
wildcards. If you want to copy a whole directory, you can simply
specify the name of the directory. Files that are larger than the
target disk, as well as non-existent files, will be skipped.


Run-time options and what is happening
======================================

When you give FFIT something to do, you will se how the fitting
proceeds. Starting with disk number one, the program will display a
number of bytes which should be rapidly decreasing. This indicates how
many bytes from the target size the best combination so far yields.

Normally the number decreases to zero in a very short moment and the
program proceeds to the next disk. FFIT will systematically examine
every possible combination before accepting the best result it can find.

If there are many files, the number of combinations are numerous and
you may think the program is not doing anything because the number is
not decreasing. Don't panic! There are just an enormous number of
combinations that have not been tested yet. Relax and let the program
do the crunching. If you run out of patience you may press ESC and
FFIT will respond with the following prompt:

[Halted!] C)ontinue, A)ccept fit or Q)uit?

Now you may q)uit the program, a)ccept the best combination so far
or c)ontinue crunching those combinations. The choice is yours.

When FFIT has determined how the files are to be grouped, it will ask
for the first disk (unless you have specified a certain starting disk
using the -d option) and at this point you might press ? or H for help.
FFIT will display:

Your possible keystrokes are:
ENTER or SPACE start working with disk
S skip this disk
ESC or Q quit program
D or ^Z shell to dos
? or H this help

Your possibilities are quite self-explanatory. Note that you cannot
skip a disk if you have given the -a option. When you go on with ENTER
or SPACE the files will be copied to the disk. Unless the option -a is
given, the disk must be totally empty. If FFIT detects data on the
disk and option -a is NOT given, the program will ask for permission
to delete the whole disk. At this point you may shell to dos and
examine the disk, try with another disk, quit the program or give FFIT
permission to delete the whole disk.


Some useful examples
====================

FFIT -t \misc\texts \temp\*.doc b:

This test-fits all files in the directory '\misc\texts' and all
files matching '\temp\*.doc' to the drive b:. Nothing will be
copied, but the program will tell you how many disks you are
going to need as well as which files are put on which disks.

FFIT a: /fms .

All files in the current directory will be fitted to a:. The
files will be copied in alphabetical order (-s), and after
each disk has been successfully copied, the source files will
be deleted (-m) without asking for permission even if some
files are read-only (-f).

NOTE! Because the option -a was NOT specified, the target
disks must be empty, and FFIT will erase the target disk
without asking since the force-option (-f) was given. Omit the
-f and FFIT will ask for permission to delete the target disk.

FFIT -a -n -u c:\foo\*.arj b:

The matching files are added (-a) to the disk(s) in drive b:.
Files already existing on the disks will be left undisturbed!
Because of this, FFIT cannot know in advance how many disks
will be needed to copy all files. You can use the test option
(-t) to achieve this. Files are copied in the same order as
specified (-n) and all filenames are printed in uppercase (-u).

FFIT -cv720k c:\backups\*.zip a:

The matching files whose archive bits are set (-c) will be fitted
to a: copying no more than 720 Kb to each disk (-v 720k).
After each file has been copied, its archive bit will be reset.

FFIT -a -v -10000 @mylist.txt a:

The files mentioned in the textfile 'mylist.txt' will be added
to the disk(s) in drive a: leaving at least 10000 bytes of
free space on each disk.

FFIT *.zip *.arj -bt144

All matching files will be fitted using the 'biggest first'
sorting. The target is assumed to be a totally empty 1.44 Meg
disk (-t144) and we are of course only testing to see how the
files would be copied.

FFIT -d5 *.gif b:

The first four disks will be skipped and copying will begin
with disk number five. This can be used to continue where
you left off if you had to abort FFIT.


As you may have noticed, there are many options and they can be freely
combined to obtain the desired result. If you think you need yet another
option which I haven't so far implemented, please tell me about it!


Known limitations
=================

Solving a knapsack problem is not such an easy task. Even if
considerable effort (not to mention all those late nights) has been
spent to make this program work, some things are just very hard to
implement. Therefore there are some limitations. Some may go away in
the future, some may not.

There is a limitation to how many files can be placed in the root
directory of a disk. This is not checked in any way, so do not be
surprised if FFIT cannot copy any more files to a disk even if there
is space left.

At the moment FFIT copies files to the root directory of the disk
only. Copying to a subdirectory means there will be a dynamic number
of sectors used for the directory. The number of sectors used, depends
of the number of files in the subdirectory. At the moment, it just
feels way too complicated to achive a "perfect fit" when having to
compensate for directory clusters also.

If you add files to a disk where there is already files having the
same name, you will be asked if to overwrite the file on the disk. In
this situation, the real amount of bytes free left on the disk (after
copying) will not be the same as the value FFIT has calculated.

If the target disk have lost clusters, you may find that FFIT will not
be able to copy all files to the disk. The last file copied may be
truncated. Use 'chkdsk /f' to fix the lost clusters on the disk and
then run FFIT again.

Perhaps the fitting algorithm could be optimized, but I think it does
the job as good and fast as it might be possible. There are of course
situations when the algorithm may do some unneccessary work, but the
result should pretty near the best possible. An example of a worst case
is if you have many files of equal size, and the size is not a whole
multiple of the space available. All combinations of the files will be
tried, even if they all yield the same amount of 'bytes left'.

More causes of grief may exist. If you find any, you will know it. If
you don't, it will probably not bother you. You have been warned!

Any good ideas to cure the known (and unknown) limitations can be sent
to the address given at the end of this document. Please report any
bugs or undocumented features found in the program.


Revision history
================

Version 1.6: Added full support for 4DOS/NDOS file comments. Added
possibility to specify disksize when using the test
option. Added the -q (quiet) option. Added check that
target is a removable medium. Added the -b (sort big
files first) option which can give a slightly better
result. Fixed two bugs in the dos-shell (prompt and
current directory restored after shell). Files are now
copied to the root of the target (as they should), not
to the current directory. Target drive can be specified
anywhere on the command line, or omitted if using the
predefined disksize test-mode. Some code simplified and
optimized. Several other small aesthetical tweaks.

Version 1.5: Fixed bug in erase_whole_disk which failed to erase
hidden and system files. Redisplay last question when
returning from dos shell. Added option 'd' and
possibility to skip disk about to be ffitted.

Version 1.4: Possibility to shell to dos. Listfiles implemented.
Added progress indicators while copying files. Added
options 'c' and 'v'. Name changed from 'fit' to 'ffit'
because there already existed a program named 'fit'.

Version 1.3: Possibility to break (cont, accept or quit) during fit.
Fixed 'bytes left'-bug. Added code selfcheck.

Version 1.2: Added add and move option and printing of bytes left on
each diskette after copying. Increased stack size,
because the program could sometimes crash when the
algorithm recursed deep enough.

Version 1.1: Added alphabetical sorting.

Version 1.0: Initial release of program.



#include :
============================

Copyright (c) 1991, 1992 Kai Risku

FFIT is offered to you "AS IS" without any warranty. This software has
been thoroughly tested but no guarantee is given that it will work on
every computer. The copyright owner may not be held liable for any
damages, direct or consequential, which may result from the the use of
this program.

This program is freely distributable. You may use the software and
share it with all your friends (and foes) as long as the program is
supplied in its original, unmodified form, which includes this
documentation. This program must not be distributed for profit.

If you have any questions, ideas, suggestions for improvements or if
you are interested in the source then feel free to contact me...

A nice postcard would be appreciated!



Snailmail: Kai Risku Email (internet): [email protected]
Kronvik
65410 Sundom
Finland



 December 25, 2017  Add comments

Leave a Reply