VFPCompression.fll is a tool created by Craig Boyd to assist developers in creating a compressed file in a zip format without the need for third party software. The new version includes zip password protection. All you have to do is download the file, and unzip it, preferrably, to your “Common /Libs” directory. Below is the link:

Later I will show you how very simple it is to call it. VFPCompression.fll offers a variety of ways to zip, unzip, open and close files or folders. However, this topic is entirely dedicated to the creation of a zip file and how to protect it further by giving the user the ability to change the password from time to time.

So let us now start the demonstration of how we can extend beyond the current limit Craig Boyd’s VFPCompression.fll.

To begin, create one commandbutton and change the caption into “Create Backup for the day”. On click event, type the following:

Local lcTodayLocal, lcTodayNet, lcCreatedZip, lcTargetFolder, lcLibraryLoc, lcReadPass, lcCurrentText, lcCurrentPassword, lnCounter
* Brief description of these variables:* lcTodayLocal = will hold the full path and filename of the current day’s zip on the local unit* lcTodayNet = the same as TodayLocal but will be used in saving a copy in the mapped drive* lcCreatedZip = is the zip path + filename, in this demonstration: z:\data.zip* lcTargetFolder = the folder subject to compression* lcLibraryLoc = is where VFPCompress.fll is located* lcReadPass = holds the entire content of snaplist.txt* lcCurrentText = holds the per letter checking on ReadPass* lnCounter = necessary in skipping to the next letter * lcCurrentPassword = will hold the combined letters before the carriage Enter* Others:* lcSnaplist.txt = a text file, which will hold the password. In addition, it will also serve as a log file of all passwords used in the backup process. Snap is to break. : )

Always remember that before any compression job starts, you have to remind the current user to double-check if all other units utilizing your app are already closed.

IfMessagebox("Warning!!! Be sure that all users with the exception of this unit have "+;
"logged-out of the system as the system needs EXCLUSIVE use of ALL tables. "+;
"Proceeding while other units are still using this system will result to the open "+;
"tables be skipped or not included in the backup process. Would you like to proceed "+;
"now?",4+48,"Very Important, please read!") = 6
* Make sure that all databases and tables in you current session will be closedCloseDatabasesAll

For novice developers (newbies), you need to do the above. However, as Ken explains, there is a better alternative in doing backups without the need to “kick-out” any users off the system. Exact words follow:

“You can create local tables and then zip the contents of those local tables with something like this:” - Ken Murphy

Note: In this example, drive z: is a mapped drive on the server where my system resides. In reality, it is installed on drive d:\bbgsoft of the server, which was shared and made available to selected users. On workstations, I mapped it and assigned drive z:. Our target for compression is the DATA folder which resides inside bbgsoft folder.

m.lcCreatedZip = "z:\data.zip"

In this example, running the backup will be done by the administrator or officer on the workstation unit he/she is using. So target folder for compression is not d:\bbgsoft\data but z:\data.

m.lcTargetFolder = "z:\data"

Likewise, VFPCompression.fll is located in z:\ because that is where my system resides.

lcLibraryLoc = "z:\vfpcompression.fll"

It is always imperative, for safety purposes, to check if a folder you’re planning to use exists.

Now, as I’ve said, I will teach you how to protect your zip file better by having the ability to change the password being used in the zip file. However, the initial question would be “How can I track down which passwords I have used during a specific backup?”. It would be very very hard indeed if you already have 5 years of backup, and have changed the password over a thousand times because you felt in a certain point in time that your password has been compromised. There is one solution, write it down to keep tab of when did you change a password and what are the files that will be affected by that. However, if you can write it down on a notebook paper, then why not just create a txt file just for that purpose? In this example, I created a text file I named snaplist.txt which I will put in z:\reports folder. You can open it using notepad or plain edit using DOS environment. Below are examples of the password. Note that I use a combination of date and actual password. The date is very important because it will serve to remind me of the date when I changed a password:

Content of snaplist.txt:20080403FoxiteArticle20080402FoxiteFAQ20080315Sandstorm3620080222BBGSoft20080131SweetPotato

So, with the examples above, anything between January 31, 2008 up to February 21, 2008 bear the same password which is 20080131SweetPotato. From February 22, 2008 to March 14, 2008, password used is 20080222BBGSoft. And so on… Very important: You must terminate each new password with an Enter key because that is what I used in trapping. Also you may opt not to change password. The changing is only necessary if you think that the old one has been compromised and you decide to change it because you don’t want to give a certain person an access to new zip backup files.

With VFPCompression.fll, it is designed by default to create a zip file bearing the same name of the file or folder it is instructed to zip, i.e., if the name of the file or folder subject to compression is DATA, the compressed file will be named data.zip. If you leave it that way, then you will only have ONE zip file because every time you perform the backup, it will just overwrite the previous one with a new one.

On the following commands, you will learn how to transfer the zip file you just created into a better one by automatically creating zip files bearing the current cpu date. But first you need to “arrest” or “halt” further process pending completion of the zip job. To do that, check if compression is complete by constantly checking file size. While compression is still not finished, it has a zero byte:

DoWhileFsize(m.lcCreatedZip) <= 0
Enddo * Double check created zip file if it still existsIfFile(m.lcCreatedZip)
* This will copy the instance of the zip file you just created into the * mapped drive’s archive folder, plus bearing the cpu date as filename CopyFile(m.lcCreatedZip) To (m.lcTodayNet)
* This will copy the instance of the zip file you just created into the local c:\archive folder, plus * bearing the cpu date as filename CopyFile(m.lcCreatedZip) To (m.lcTodayLocal)
CloseDatabasesAll * Now delete the originally created zip file (data.zip)DeleteFile(m.lcCreatedZip)
WaitClearMessagebox(Dtos(date())+" Backup Creation is Complete!",0+64,"Backup Successfully Created!")
EndifElseMessagebox("Creation of "+Dtos(date())+" backup has been aborted!",0+48,"Oooooppssss!")
Endif* End of extended backup process

For a more thorough reading about the subject matter, google VFPCompression.fll

ABOUT THE AUTHOR: JUN TANGUNAN

I am an Accounting graduate by profession. In my 3rd year of college, I was introduced to simple basic programming (MSDOS BASICA) where immediately I realized my real passion. But I am not used to leaving things halfway so I graduated accounting and pursue programming on my own (via reading and actual implementation) while working in a bank. Later in life, I realized that I made the right choice because my knowledge in Accounting made me a better system analyst on business software. I am a very simple man; I treat anybody as equal as long as I was shown back respect. I always go for attitude and heart. I never envy anybody; I am a very content person. I never demand recognition or fame; knowing that I am able to help somebody is enough for me. In some ways, I still think and act like a child (and sometimes I can be very naughty, so give me allowance guys whenever it happens! LOL!) and I am always proud of that. I was blessed to have the capability to make myself laugh even on simple things. My advice, always look on the brighter side of life. It will peel layers of years away from your life. Smile : )

Sorry for the late response eriq, I only read your request just now because I seldom went here. Anyway, it is not clear what you want. What I suggest you must do however is to start working on your project. Then if you encounter some problem, create a thread in the forum and members who can will surely help you.

It is better that way because a lot more will benefit out of it than me giving you some samples and instructions via email. I hope you understand.

Hi Jun,I've been checking your foxite articles and your programs.Although I don't fully understand them I can tell that you are a good programmer.I know your history. You like playing pool, binggo and jumping into countryside rivers.I know your father and mother and your 2 brothers and your sister.Could you help me do a program? I'll tell you the details if you call my number.Hope you know it. If not, then check my facebook or friendster.