Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: FoxPro FAQ

Utility Program

How to keep multiple versions(999+) of your source files ? by NasibKalsi
Posted: 16 Dec 07 (Edited 23 Dec 07)

For Backup/Zip download any of the tools such as cabarc(MicroSoft), Zip tools, etc. Replace the pkzip line in the code with your own file generating utility/program. You may comment out that line if file generation is not required. To see the demo, create a directory on c:\Bak123. Then create 2 dummy files abcd.101, abcd.102 respectively. Comment the pkzip line. Save the code into c:\Bak123\bak123.bat and run in dos windows.


@echo off
rem -----------------------------------------------------
rem This batch file will rename files of the order
rem abcd.102 to abcd.103
rem abcd.101 to abcd.102
rem and frees the first slot for a newer file.
rem This utility batch can be used for keeping last upto 899 files,
rem for backup(old versions). It may be helpful in case the class, or other files
rem get corrupted and requires a backup.
rem Uses pkzip.exe. You can use any other zip/report program which generate a single file
rem that requires last finite number of versions(999,9999, ...)
rem No (c) copyright of any kind.
rem Nasib Kalsi 2007-12-02
rem Handle files of the order abcd.199, abcd.198,  ... abcd.101
echo .
echo . Working, please wait
echo .

rem --------------------------------------------------
rem Modify the following parameters as per your requirements
rem No spaces around = sign
set SourceFiles=p:\uw\inv\*.*
set BakDir=c:\Bak123
set FileName=abcd

set/a RootFileExt  = 100
set/a FirstFileExt = RootFileExt + 1
set/a LastFileExt  = 199

rem --------------------------------------------------

rem Make BackupDir
if exist %BakDir%\%FileName%.%FirstFileExt% goto Begin
md %BakDir%

   set /a LastFileExt = LastFileExt - 1
   if %LastFileExt%==%RootFileExt% goto End
   if exist %BakDir%\%FileName%.%LastFileExt% goto Yes
   goto Begin

   set /a j = LastFileExt + 1
   ren %BakDir%\%FileName%.%LastFileExt% %FileName%.%j%
   goto Begin


rem Now create a zip/report file in slot 101 (abcd.101)
pkzip %BakDir%\%FileName%.%FirstFileExt% %SourceFiles%

echo .
echo . Done
echo .

Back to Microsoft: FoxPro FAQ Index
Back to Microsoft: FoxPro Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close