INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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!

*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.

Jobs

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.



CODE

@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
rem No (c) copyright of any kind.
rem Nasib Kalsi 2007-12-02
rem
rem Handle files of the order abcd.199, abcd.198,  ... abcd.101
rem
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%

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

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

:End


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

echo .
echo . Done
echo .

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

My Archive

Resources

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