Backup: using a bat file. The Bat! — Backup and search capabilities Restore the bat from a backup

Home / Breakdowns

The man in the woolen cloth jacket was completely depressed by the official situation,
the smell of alizarin ink, hours of breathing quickly and heavily,
and especially with the strict poster “You’ve done your job - and leave.”
Although the man in the jacket had not yet started his business, he already wanted to leave.

September 9, 2007

Recently I felt the need to have backup of one database over the past few days. One of the conditions was to implement all this without using third-party or home-written programs. After some thought, it was decided to implement this using standard DOS commands described in the .bat file.

Those who know how to write BAT files may not read further at all. For others, I’ll explain that all lines starting with rem are comments. Therefore, they are not executed and you can copy the entire code.

And the algorithm is very simple. We have two folders archive_new , where the archive for yesterday is stored, and archive_old , where the archive for the day before yesterday is stored. Thus we get the following:


rmdir /s /q \\server\archive\archive_old

ren \\server\archive\archive_new archive_old

mkdir \\server\archive\archive_new
rem Copy the database files to the archive_new folder
copy /y *.base \\server\archive\archive_new

All. With this algorithm running once a day, we will have two backup copies: for yesterday and the day before yesterday.

This simplest algorithm is ideal when you just need to copy files to another location. It has two disadvantages.

Firstly, the databases can be large.

Secondly, absolute paths are written here, and if you change the settings or structure, you will have to correct all the paths in the file.

Two of these disadvantages are easily solved by archiving the databases and setting variables for relative paths.


rem The current date will be used instead of the archive name
SET archive_name=%date%.rar

rem Delete the archive_old folder

rem Rename the archive_new folder to archive_old

rem Create a directory archive_new

rem Archive all files except *.exe and *.bat
rar a -r -m5 -x*.bat -x*.exe %archive_name%
rem Copy the archive with the database to the archive_new folder
copy /y %archive_name% %server_dir%\archive_new \
rem Moving the archive
move %archive_name% %serev_dir%\archive_new \

NB: in order for the archiving line to work, you will need the “rar.exe” file from the standard WinRar package.

The above example has one main disadvantage: if the database is constantly used by the application, then the archiver will not be able to access it. In this case, you will have to slightly adjust the design and first copy the files to another directory, where they will be archived.

rem Declare variables for the name of the archive and the path of the archive folder on the server
SET archive_name=%date%.rar
SET server_dir=\\server\archive\
SET temp_dir=\\temp\
rem Delete the archive_old folder
rmdir /s /q %server_dir%\archive_old
rem Rename the archive_new folder to archive_old
ren %server_dir%\archive_new archive_old
rem Create a directory archive_new
mkdir %server_dir%\archive_new
rem Copy the database files to the temp folder
copy /y *.base %temp_dir%
rem Archive all files in the temp folder, except *.exe and *.bat
rar a -r -m5 -ep1 -x*.bat -x*.exe %archive_name% %temp_dir%
rem Move the archive to the archive_new folder
move %archive_name% %server_dir%\archive_new \
rem Clear the contents of the temp folder
del /q %temp_dir%*.*

In general, that’s all. Now all that remains is to schedule the execution of this .BAT file and you don’t have to worry about the safety of the site’s database.

P.S. For those who want to get creative, most of the things described here can be done through keys in RAR.

Backup The Bat! allows you to save copies of letters from a popular email client on external media. In The Bat! includes a backup utility, but it is much more convenient to use The Bat! to create a backup copy! universal programs, for example, Handy Backup.

How to backup Bat! using Handy Backup?

Copying The Bat! in Handy Backup is carried out using a standard plugin Computer. To create a task that automatically runs for The Bat! To copy the catalog, please use the instructions below.

  1. Open Handy Backup. Open the New Task Wizard using the button or Ctrl+N keys.
  2. In Step 1, indicate that you are creating a task backup.
  3. Go to Step 2 and open the Local and Network Drives group in the left pane.
  4. Double click on the plugin name Computer. A new window will open.

  1. Find the working directory of The Bat!
  2. If necessary, please tick the boxes. The Bat backup data in the catalogue.
  3. Click OK. Then proceed to Step 3 by clicking “Next”.

Advice: you can also customize for The Bat! backup files by mask by clicking the “File filters” button in Step 2 and selecting in the dialog that opens the name masks of the files you want to copy (for example, the internal files of the Bat backup have a name mask *. tbk).

  1. In Step 3, you can select a suitable storage location for The Bat!
  2. Steps 4 and 5 are needed to configure additional backup features. If you need detailed descriptions of these steps, please refer to the User Guide.
  3. In Step 6 you can automate the launch of your task, adjusting the repeat time and frequency, or selecting the events that trigger the trigger.

  1. Skip Step 7 if you don't need to run additional programs before or after the task (for example, you don't want to stop and restart The Bat! while performing a backup operation.
  2. In Step 8, give your task a name. Quit the Task Wizard.

How to complete for The Bat! recovery of letters?

For The Bat! Directory restoration can be performed automatically. Create a recovery task in the task wizard, and in Step 2 select The Bat! backup storage location. and find the required file in it backup.hbi , containing all the information about the data being recovered.

Recommended solution for mail backup The Bat! and restoring from backup

Download

Buy!

Version 8.0.2 dated May 8, 2019. 104 MB
Backup program Handy Backup. 1200 RUB for a license

Create backup copies of The Bat! to any backup storage devices. Free, fully functional trial period - 30 days!

Basic mail backup and recovery features of The Bat!

Flexible settings

Compared to the built-in utility the Bat! Backup, Handy Backup provides many additional functions: encryption, compression, the ability to produce for The Bat! copying over the network, storing multiple versions of Bat mail backup, backup timestamps, etc.

Variety of storage

You can choose where The Bat backups obtained using Handy Backup are stored. At your service are local drives, external USB drives, NAS devices, FTP, SFTP and FTPS servers, cloud services (for example, backup to Yandex.Disk, Google Drive, Backblaze, etc.).

Copying Bat folders using Handy Backup can be started at exactly the specified time (with an interval from a minute to several months), or by a system event (login,

If you use an email client to work with mailThe Bat! , then you probably came across the automatic reservation function. On a certain day and a certain time (which are set in the settings), the program begins to create an archive with data at the most inopportune moment.

I don't see anything wrong with this process. But if you have a computer with minimal performance (and this is most likely the case, since programs of this type are most often used in offices), then at the most inopportune moment The Bat! launches its clumsy operation, which “freezes” the computer.

It is not easy to cancel the archiving operation at the moment; it simply freezes. Even to close it, you need to call the device manager (key combination Ctrl + Alt + Delete).

Therefore, it is better to change the time at which the archive will be created or turn it off completely. In the latter case, archiving will have to be started manually.

To go into settings, open . There we find the point "System" and uncheck the box opposite “Copier. Every".

If you need to configure backup, in particular, specify the location where the archive is saved, configure what needs to be archived and other parameters, you need to go to “Properties → Settings → System” and press the button "Additionally". There in the tab "General" select the directory in which the backup copies will be saved, and also note what to copy (mailbox properties, mail folders, address books, user settings, files attached to letters).

At the bottom of the same window, select the mailboxes that will be processed (if you have several), as well as address books.

Tab "Additional" allows you to set a password for the archive. This way you can be sure that no one but you will be able to use personal letters and information contained in the archive.

Tab "Folders" allows you to specify folders for processing. By default, all are selected.

Anyone who is not yet familiar with the The Bat! email client can do so using the link below.

The Bat!—program No. 1 for working with email. This program has many victories in various tests. This email client supports all possible protocols and encryption methods. The client is easy to configure (for most popular email services, almost automatically, you only need a login and password) and requires a small amount of system resources and, according to my observations, better displays the contents of letters and correctly synchronizes with the server. Works with IMAP4, POP3, APOP, SMTP, SMTP authentication protocols.


In the mail program The Bat! You can configure automatic creation of a backup copy of data, which will occur at a specified time.

Method 1

To enable automatic backup, you need to go to the menu Properties -> Settings -> System and select in the Backup section Copy every … days, the value of days can be changed. Next, you need to set the start time for creating the backup.

Click on the button Additionally to go to automatic backup settings.

In the section General You can choose one of two backup methods. Standard method involves creating a backup file containing all data marked for copying. The automatically created backup file is named autobackup.tbk. Clicking the button Review, you can change the path to save this file. To use the second method Addition to a previously created archive, you must select an existing backup file by clicking on the button Review. In this case, the automatically created backup file will include only the data that is not in the selected archive. In this section, you can select which data will be included in the backup (Mailbox Properties, Mail Folders, Address Books, User Settings, Attached Files), and also mark those mailboxes and address books that you want to save in the archive.

In the section Additional you can add Comment to the backup file and install Password. It will be possible to restore data from a password-protected copy only after entering this password.

In the section Folders you can mark those folders that will be included in the archive. To quickly select folders, you can use the previously created A set of folders.

To save the settings, press the button OK.

Method 2

Automatic backup can also be configured in Planner.

Go to menu Tools -> Scheduler(key combination Alt+F11). In the list of events, call the context menu by right-clicking and select Create(hotkey Insert). Next you need to configure the event:

In the field Description specify the name of the event that will be displayed in the first column of the event list.

Next, indicate date And start time events. Duration There is no need to specify automatic backup, since the event will automatically complete when the backup is completed.

Make sure the event actively.

When option is active Notify about this event you will receive a warning a certain time before the backup starts. Activate this option so that automatic backup does not interfere with your work in the email client - while the backup is being created, the program's functions will be unavailable.

If the email client was not running at the specified time, automatic backup will not be performed, however, if you activate the options When starting, report missed events And Perform actions of missed events, then when you start the program, automatic data backup will be performed.

In the section Actions click the button Add and select an action Backup.

In the section Repetition you can set the conditions for repeating the automatic backup action by selecting the option Repeat this event every and the corresponding value of seconds/minutes/hours/days/weeks/months/years.

In the section Special You can set a more precise frequency for automatic backups.

To change the automatic backup event settings, you need to go to Scheduler, select the corresponding event in the list, call the context menu by clicking the right mouse button and select Properties(hotkey Enter).

We continue to study the mail program The Bat! In this tutorial we will look at backing up and restoring mailboxes along with all the settings, search capabilities and (hot key).

Backup

In previous lessons we studied But when you reinstall the system or run the program on another computer or laptop, it becomes necessary to reconfigure sending and receiving mail for each mailbox, automatic sorting, letter templates, etc. The task becomes especially complicated when there are many mailboxes and they are registered on different mail services. This problem is solved by backup, thanks to which you can not only restore all the settings of e-mail boxes, but also all incoming and outgoing letters in these boxes.

Let's look at the procedure for creating and restoring a backup copy of The Bat! using screenshots. The picture below shows where the corresponding menu items are located.

To create a backup copy, select the menu item of the same name and in the next window set the path and name of the future archive by clicking on “Browse”. If necessary, we write a comment on the archive.

IMPORTANT! When specifying a location to create an archive, select a disk other than the system one, since the archive may be overwritten when the system is reinstalled. For example, if the system is located on drive “C”, then indicate the location for the archive to “D”, “E” or on a flash drive.

After clicking “OK”, a window will appear in which you can select all or individual mailboxes for archiving. You can also set a password for the archive if necessary.

After clicking “OK” again, the The Bat backup process will start!

To restore from a backup, select the appropriate menu item (see the first screenshot). Next, click “Add” and find the archive created earlier. Then click “OK”. In the next window, select the mailboxes to be restored and click “OK” again. We wait for some time and enjoy the result

By the way, if you use the portable version of The Bat!, which is not located on the system disk, then after reinstalling the system the mail client will not need to be restored at all - it will be immediately ready for use. You just need to re-create the shortcut to the executable file on the desktop.

Search in The Bat!

Email client The Bat! has a powerful search that uses fine-tuning of the parameters of the information you are looking for. If you have a dozen mailboxes and hundreds or even thousands of letters in them, then this tool is simply irreplaceable.

Here are the search criteria you can customize:

1. Calling the search window
2. Search terms. You can select the following options:

  • text
  • sender (email)
  • recipient (email)
  • title
  • note
  • attached files
  • any part

3. Delete a condition
4. Add a new condition
5. Selecting the “AND”, “OR” parameter
“AND” - all specified conditions must be met
“OR” – at least one of the specified conditions must be met
6. Selecting boxes and folders to search
7. Start searching
8. Advanced search - makes it possible to set search parameters even more precisely. For example: letter size, letter attribute (status), statute of limitations, time interval and other criteria. I will not consider this mode. Everything is intuitive there, I think you’ll figure it out.

Let's look at two search examples:

Example 1. Let's say we need to find all letters with the phrase in the subject “Windows 7 lesson” or “Windows 7 lesson” (we don’t remember exactly). We will search in all mailboxes. The search setup will look like this:

Example 2. It is necessary to find a letter from the author (sender) D. Pecherkin, which contains the phrase “how to make money in affiliate programs” in the text, but does not contain the word “newsletter”. It is also known that the letter is in the Yandex mailbox. The settings will be like this:

Hotkeys The Bat!

Mail program The Bat! has a set for quickly calling a particular function. Here are the most commonly used combinations:

  • create a letter - Ctrl+N
  • get new mail - F2
  • get mail for all mailboxes at once - Alt+F2
  • send mail - Shift+F2
  • mailbox properties - Alt+Enter
  • quick response to a letter - Ctrl+Enter
  • calling a template - Ctrl+space
  • creating a sorting rule - Shift+Ctrl+F
  • search - F7
  • address book - F8

See all The Bat hotkeys! can be found in the program menu opposite the corresponding commands.

The program also has the ability to set your own hotkey combinations through the “Properties” / “Settings” menu / section “Other options” / “System keys”.

That's all I wanted to tell you for now about The Bat! I hope the information in this lesson will be useful to you and will help you work more productively with this wonderful program!

© 2024 ermake.ru -- About PC repair - Information portal