In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail the script about how to copy files in vbs. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
The copy code is as follows:
Parentfolder = "c:\"
Sourcefile = "c:\ windows\ log.log"
Targetfolder = parentfolder & date & "\"
Set objshell = createobject ("shell.application")
Set objfolder = objshell.namespace (parentfolder)
Objfolder.newfolder date
Set so=createobject ("scripting.filesystemobject")
So.getfile (sourcefile) .copy (targetfolder)
After the recent need to write the following code, you can determine whether the file is updated and the file size is larger.
The copy code is as follows:
Dim fso
Set fso = CreateObject ("Scripting.FileSystemObject")
Set fn2=fso.GetFile ("c:\ index2.htm")
Flsize2=fn2.size
Fldate2=fn2.datelastmodified
Set fn=fso.GetFile ("c:\ index.htm")
Flsize1=fn.size
Fldate1=fn.datelastmodified
If fso.FileExists ("c:\ index2.htm") and flsize2 > 50000 and fldate2 > fldate1 Then
Fso.getfile ("c:\ index2.htm") .copy ("c:\ index.htm")
If err.number=0 then WriteHistory "success" & now (), "log.txt"
End if
Sub WriteHistory (hisChars, path)
Const ForReading = 1, ForAppending = 8
Dim fso, f
Set fso = CreateObject ("Scripting.FileSystemObject")
Set f = fso.OpenTextFile (path, ForAppending, True)
F.WriteLine hisChars
F.Close
End Sub
Here's a more functional code:
The copy code is as follows:
WScript.Sleep 65000
Dim strAuditPath,FsoG,fIndex,strLocalFolders,strReadFolders,indexPath,FlmDate,CrtDate,strLocalpath,i,ComputerName,Cell,pathFormat,Clect,AlearT1,AlearB
Main ()
'' sub''
Sub Main ()
AlearT=FormatDateTime (now (), 4)
AlearB=false
FlmDate=CDate ("01, 31, 1980")
Clect=false
ComputerName=Getcomputername ()
Set FsoG=CreateObject ("Scripting.FileSystemObject")
GetSetting
'pathFormat=Left (strLocalpath,Len (strLocalpath)-8) & "Labels"
IndexPath=strAuditPath & "Index.txt"
Set f=FSOG.OPENTEXTFILE (GetAbPath (strAuditPath) & "logo history.txt", 8Jing true)
F.writeline FormatDateTime (Now (), 4) & "\" & cell & "\" & computername
F.close
'* calculate the local FORMAT****
'Getformat
'*
'There is a loop to compare log update dates
Do while (1)
If (fsoG.FileExists (indexPath)) Then
'indicate the last update time
Set fIndex=fsoG.GetFile (indexPath)
CrtDate=fIndex.DateLastModified
If FlmDate
< CrtDate Then strReadFolders=ReadLinetextFile(indexPath) strLocalFolders=ShowFolderList(strLocalpath) DowithChange FlmDate = CrtDate End If End if ''**********update vbs***** 'If (fsoG.FileExists(getAbpath(strAuditPath) & "pe.vbs")) Then 'fsog.CopyFile getAbpath(strAuditPath) & "pe.vbs",GetAbpath(GetCPath) & "pe.vbs" 'end if '*************************** 'end if '*************************************** if Hour(FormatDateTime(Now(),4))>= Hour (TimeValue ("11:00:00") and Hour (FormatDateTime (Now (), 4)) = Hour (TimeValue ("15:00:00")) and Hour (FormatDateTime (Now (), 4)) = Hour (TimeValue ("7:00:00")) and Hour (FormatDateTime (Now (), 4))
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.