Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Need Batch file to create rolling backups of user specified files

Posted on 2004-08-11
7
347 Views
Last Modified: 2012-06-27
Looking for a batch file that will create rolling backups of certain files or folders. For  example when the user clicks on an icon the batch file should run the backup routine. The backup routine backs up the files and folders listed in the file and lables the results Backup 1. When run again the same occurs however Backup 1 is renamed Backup 2 and the newest backup is named Backup 1. A maximum of 5 backups is created with the 6th bieng deleted when the total number of backups reaches 5. I'd like to be able to ammend the list of files and also to specify the location of the backups. Ability to direct backups to a network drive or second local drive is a bonus.
0
Comment
Question by:Abacustechnologies
  • 4
7 Comments
 
LVL 10

Expert Comment

by:For-Soft
ID: 11775416
What OS are you using?
0
 
LVL 10

Expert Comment

by:For-Soft
ID: 11775563
This is the simplest solution I've found:

if exist backup5.zip rename backup5.zip backup6.zip
if exist backup4.zip rename backup4.zip backup5.zip
if exist backup3.zip rename backup3.zip backup4.zip
if exist backup2.zip rename backup2.zip backup3.zip
if exist backup1.zip rename backup1.zip backup2.zip
del backup6.zip
pkzip -r -p backup1.zip c:\temp\1\*.*
0
 

Author Comment

by:Abacustechnologies
ID: 11775711
Sorry All,  Forgot to mention OS is Windows 95 to XP.

Also, this batch file should, IMHO, consist of two parts. The first backs up the list of files and folders it contains while the second creates the actual backup file as well as renaming the backup as indicated by For-Soft.

Hope this clarifies things somewhat.

Dave
0
 
LVL 10

Expert Comment

by:For-Soft
ID: 11775912
It would be good to know, what backup metod should be used.
It is possible to use list file with pkzip compressor.
Arj is also capable of using list file.
0
 
LVL 10

Accepted Solution

by:
For-Soft earned 400 total points
ID: 11776098
pkzip backup1.zip @list
or
arj a backup1.arj !list

---------------------- list
c:\temp\1\*.*
c:\temp\2\*.*
C:\temp\test.txt
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question