VBS backs up the specified file to the specified directory and renames the implementation code by date

Time:2021-10-15

When it comes to backup, I believe the first method everyone will think of is to back up data through the windows backup function of the windows system. Later, after Microsoft released the system center product, a new backup product system center data backup manager (DPM) appeared. These functions can back up relatively large data, but it is a bit wasteful for the backup of small files, because sometimes it is not necessary to back up several important files (configuration files) due to work. Therefore, many backup software are a bit wasteful and not very convenient for the backup of small files. These are just personal thoughts. I’m a picky person. The work that can be realized in a simple way will never be too complicated.

The company uses IBM Lotus products as the mail system. As we all know, lotus mail product databases are independent file databases that end in. NSF. There is also a. NTF database template. The service periodically refreshes the. NSF database through the corresponding. NTF template file. I won’t say so much here. Let’s mainly talk about the problems encountered ~ last week, my colleagues found out how some Domino server configurations deleted before were restored. Of course, I’m not bored to do some restoration. Then I compared the recent data backup and deleted it again. The leader told me to back up the lotus configuration database regularly. So I want to backup through VBS program. As we all know, the Domino server configuration database is names. NSF. As long as the names.nsf database is backed up, the configuration of the Domino server will not be lost. If there is a problem, just overwrite the recovery. Another problem is that the history of the previous backup must be kept for a backup, and the backup can be renamed according to the local backup date and time. The solution to this problem is shown below:

VBS backs up the specified file to the specified directory and renames the implementation code by date

code:

?
1
2
3
4
5
6
7
sourcefilepath="c:\names\names.nsf"
desfilepath="d:\name_backup\name"&""&year(date)&-month(date)&-day(date)&" "&hour(time)&-minute(time)&"\"
set fso=createobject("scripting.filesystemobject")
if not fso.folderexists(desfilepath) then
fso.createfolder desfilepath
fso.copyfile sourcefilepath,desfilepath
end if

Simulate copying names.nsf in the names folder on Disk C to the destination directory

VBS backs up the specified file to the specified directory and renames the implementation code by date

Copy the names.nsf file on Disk C to the destination path on disk D

VBS backs up the specified file to the specified directory and renames the implementation code by date

Execute once, create a new folder under the folder, and then save the copied file into the file. Then name it after the date

VBS backs up the specified file to the specified directory and renames the implementation code by date

File storage

VBS backs up the specified file to the specified directory and renames the implementation code by date

Execute once a day. Once, create a new folder under the folder, and then name it with the date

VBS backs up the specified file to the specified directory and renames the implementation code by date

Then run the program through the planned task of the system: taskschd.msc

VBS backs up the specified file to the specified directory and renames the implementation code by date

After opening the scheduled task, we create the task

VBS backs up the specified file to the specified directory and renames the implementation code by date

Define the name and operation mode of the planned task: it should be run whether the user logs in or not

VBS backs up the specified file to the specified directory and renames the implementation code by date

The program operation plan is executed once every 23.54 days. Check — enabled option

VBS backs up the specified file to the specified directory and renames the implementation code by date

Scheduled task created

VBS backs up the specified file to the specified directory and renames the implementation code by date

Create a task action— Start the program – then we choose the defined script file

VBS backs up the specified file to the specified directory and renames the implementation code by date

Define scheduled operation complete

VBS backs up the specified file to the specified directory and renames the implementation code by date

Let’s right-click to start running once. Test.

VBS backs up the specified file to the specified directory and renames the implementation code by date

Execute the effect and run again at the specified time the next day:

VBS backs up the specified file to the specified directory and renames the implementation code by date

Well, that’s all for this article

Recommended Today

SQL statement of three-level linkage of provinces, cities and counties

The first is the table creation statement Copy codeThe code is as follows: CREATE TABLE `t_address_province` ( `id` INT AUTO_ Increment primary key comment ‘primary key’,`Code ` char (6) not null comment ‘province code’,`Name ` varchar (40) not null comment ‘province name’)Engine = InnoDB default charset = utf8 comment = ‘province information table’; CREATE TABLE […]