Tag: VBS reads information from a file to move non-valid data to the specified path
VBS reading information from a file moves non-valid data to the specified path
Before we introduced, by reading the information in the file to copy the same data to the specified directory, after execution we can take advantage of valid information, but the time is long, the server will be more available space, so again want to use the VBS script to determine whether the data is useful, to improve the server's free space.
The idea is that, by exporting valid data from the Domino directory and then making a comparison with the local data disk, the invalid database is moved to another disk operation, and if the deletion is done without affecting the integrity of the data, how does it work, The first is to define an xlsx file (1.XLSS), which can be arbitrarily named, but it needs to correspond to the files in the script. Then define the data source (d:\data), then set some files with an. nsf extension, and then create a target source (d:\data1) in the corresponding. specifically see below:
1. If we only need to export directory information on the specified server, open the NAMES.NSF data through the Notes console------Messaging--------Mail Users, you can select it by right-clicking the export
650) this.width=650; "title=" clip_image002 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image002" src= "http://img1.51cto.com/attachment/201410/12/451336_14130962643l5q.jpg" height= "347"/>
2. Define the script content:
1> . Compare files------Scripts to read the comparison file, the contents of the file as a copy.
2>. The source file-----Copy the same data by comparing the files in the script with the source files.
3>. after the target file is-----compared, the path of the same file is copied and stored
650) this.width=650; "title=" clip_image004 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image004" src= "http://img1.51cto.com/attachment/201410/12/451336_1413096264cqrl.jpg" height= "317"/>
Code:
Currentfolder=createobject ("Wscript.Shell") .currentdirectory& "\" filename1=currentfolder& "1.xlsx" Sourcefolderpath= "D:\data" "". NSF Storage directory Desfolderpath= "d:\data1\" "Move target directory set dic= CreateObject ("Scripting.Dictionary") set fso=createobject ("Scripting.FileSystemObject") Set Sourcefolder = fso. GetFolder (Sourcefolderpath) Set desfolder=fso. GetFolder (Desfolderpath) set excelobject=createobject ("Excel.Application") set workbook1= ExcelObject.Workbooks.Open (filename1) Set workbook1_sheet=workbook1. Sheets ("Sheet1") workbook1_rowcount=workbook1_sheet.usedrange.rows.countfor i=0 to workbook1_ Rowcountcontent=trim (Workbook1_sheet.range ("A1"). Offset (i,0). Value) If not dic. Exists (content) Thendic.Add content,contentEnd IfNextFor Each file In Sourcefolder.filesfilenamestr=file. Namefilenamearray=split (Filenamestr, ".", -1) Filename=filenamearray (0) If (not dic. Exists (fileName)) thenfso. Copyfile file. Path,desfolderpath,truefso.deletefile file. Pathend ifnextworkbook1.closeset workbook1=nothingset excelobject=nothingset dic= nothingmsgbox "Execution succeeded" function regexptest (PATTERN,STR) set reg = new Regexpreg.pattern=patternreg. Global=truereg.ignorecase=trueregexptest=reg. Testend function
3. After defining the script, we create the required contrast file, 1.xlsx (Sheet1)
650) this.width=650; "title=" clip_image006 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image006" src= "http://img1.51cto.com/attachment/201410/12/451336_1413096264mFyP.jpg" height= "265"/>
4. Set source path and content
650) this.width=650; "title=" clip_image008 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image008" src= "http://img1.51cto.com/attachment/201410/12/451336_14130962649KL9.jpg" height= "259"/>
5. Set up a signpost path
650) this.width=650; "title=" clip_image010 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image010" src= "http://img1.51cto.com/attachment/201410/12/451336_14130962641NTN.jpg" height= "266"/>
6. The contrast file (1.xlsx) file and the well-defined script file are then stored in a directory.
650) this.width=650; "title=" clip_image012 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image012" src= "http://img1.51cto.com/attachment/201410/12/451336_1413096264EANy.jpg" height= "217"/>
7. Start running: Double-click to run.
650) this.width=650; "title=" clip_image014 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image014" src= "http://img1.51cto.com/attachment/201410/12/451336_1413096264IpKR.jpg" height= "265"/>
8. Look at the results:
650) this.width=650; "title=" clip_image016 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image016" src= "http://img1.51cto.com/attachment/201410/12/451336_1413096264dpaG.jpg" height= "234"/>
9 Comparing source file directory and source file contents
650) this.width=650; "title=" clip_image018 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px, "border=" 0 "alt=" clip_ image018 "src=" http://img1.51cto.com/attachment/201410/12/451336_1413096264iav4.jpg "height=" 244 "/>
This article is from the "Gao Wenrong" blog, make sure to keep this source http://gaowenlong.blog.51cto.com/451336/1562886
VBS reads information from a file to move non-valid data to the specified path