Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write the implementation code that Vbs backs up a specified file to a specified directory and renames it with a date?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about Vbs backup specified files to the specified directory and renamed to the date of the implementation code how to write, editor feel very practical, so share to you to learn, I hope you can learn after reading this article, say no more, follow the editor to have a look.

When it comes to backup, I believe the first method that everyone will think of is to backup data through the window backup function that comes with the windows system. Later, after Microsoft produced the system centere product, there was a new backup product-system centere data backup manager (DPM). These functions are OK to back up relatively large data, but the backup of small files is a bit wasteful, because sometimes due to the need to back up several important files (configuration files), it does not need to be complete, so, many backup software is a bit wasteful, which is not very convenient for the backup of small files. These are just personal thoughts. I am a rather fastidious person, and the work that can be achieved in a simple way will never be too complicated.

The company uses ibm lotus products as its mail system. As we all know, lotus mail product databases are separate 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. Let's not say so much here. Let's mainly talk about the problems encountered. Last week, my colleagues found out how some of the domino server configurations deleted earlier had been restored. Of course, I'm not bored to do some restoration. Then compared with the recent data backup, and then deleted again, the leader told me to back up lotus's configuration database on a regular basis. So I want to back up through the 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, you just need to overwrite and restore. One backup must retain the history of the previous backup and rename it through the date and time of the local backup. The solution to this problem is as follows:

Code:

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) Thenfso.CreateFolder desfilepathfso.copyfile sourcefilepath,desfilepathEnd If

Simulate copying the names.nsf under the names folder under disk c to the destination directory

Copy the names.nsf file under disk c to the destination path under disk d

Create a new folder under this folder at a time, and then save the copied file to the file. Then name it after the date.

File deposit

Execute once a day, create a new folder under that folder, and then name it with a date

Then run the program through the scheduled task that comes with the system: taskschd.msc

After we open the scheduled task, we create the task

Define scheduled task naming: and operation mode: run regardless of whether the user is logged in or not

The program is scheduled to run 23.54 times a day. Check-enabled option

Scheduled task created and completed

Create a task action. -start the program-then we select the defined script file

Define plan operation completed

Let's right-click to start running once. To test it.

Execute the effect, and run again at the specified time the next day.

The above is how to write the implementation code that Vbs backs up the specified files to the specified directory and renames the date. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report