Forums
New posts
Search forums
News
Security News
Technology News
Giveaways
Giveaways, Promotions and Contests
Discounts & Deals
Reviews
Users Reviews
Video Reviews
Support
Windows Malware Removal Help & Support
Mac Malware Removal Help & Support
Mobile Malware Removal Help & Support
Blog
Log in
Register
What's new
Search
Search titles only
By:
Search titles only
By:
Reply to thread
Menu
Install the app
Install
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Support
Windows Malware Removal Help & Support
Help needed to get rid of the dreaded GoSave
Message
<blockquote data-quote="dote37" data-source="post: 308579" data-attributes="member: 31352"><p>Hope this is what you are looking for:</p><p>Option Explicit</p><p>Dim fs, objFSO, objLogFile, oFolder</p><p>Set fs = CreateObject("scripting.filesystemobject")</p><p>oFolder = Wscript.Arguments.Item(0)</p><p>Const ForAppending = 2</p><p>Set objFSO = CreateObject("Scripting.FileSystemObject")</p><p>Set objLogFile = objFSO.OpenTextFile("test.txt", ForAppending, True)</p><p>objLogFile.Write(oFolder & " (F=")</p><p>objLogFile.Write CountFiles(oFolder)</p><p>objLogFile.Write(" D=")</p><p>objLogFile.Write CountFolders(oFolder)</p><p>objLogFile.Write(" ")</p><p>objLogFile.Write FolderSize(oFolder)</p><p>objLogFile.Write(" bytes)" & vbCrLf )</p><p>objLogFile.Close</p><p>Function CountFolders (ByVal StrFolder)</p><p>Dim ParentFld</p><p>Dim SubFld</p><p>Dim IntCount</p><p>Set ParentFld = fs.GetFolder (StrFolder)</p><p>IntCount = ParentFld.SubFolders.Count</p><p>For Each SubFld In ParentFld.SubFolders</p><p>IntCount = IntCount + CountFolders(SubFld.Path)</p><p>Next</p><p>CountFolders = IntCount</p><p>End Function</p><p>Function FolderSize (ByVal StrFolder)</p><p>Dim ParentFld</p><p>Dim IntCount</p><p>Set ParentFld = fs.GetFolder (StrFolder)</p><p>IntCount = ParentFld.size</p><p>FolderSize = IntCount</p><p>End Function</p><p>Function CountFiles (ByVal StrFolder)</p><p>Dim ParentFld</p><p>Dim SubFld</p><p>Dim IntCount</p><p>Set ParentFld = fs.GetFolder (StrFolder)</p><p>IntCount = ParentFld.Files.Count</p><p>For Each SubFld In ParentFld.SubFolders</p><p>IntCount = IntCount + CountFiles(SubFld.Path)</p><p>Next</p><p>CountFiles = IntCount</p><p>End Function</p></blockquote><p></p>
[QUOTE="dote37, post: 308579, member: 31352"] Hope this is what you are looking for: Option Explicit Dim fs, objFSO, objLogFile, oFolder Set fs = CreateObject("scripting.filesystemobject") oFolder = Wscript.Arguments.Item(0) Const ForAppending = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objLogFile = objFSO.OpenTextFile("test.txt", ForAppending, True) objLogFile.Write(oFolder & " (F=") objLogFile.Write CountFiles(oFolder) objLogFile.Write(" D=") objLogFile.Write CountFolders(oFolder) objLogFile.Write(" ") objLogFile.Write FolderSize(oFolder) objLogFile.Write(" bytes)" & vbCrLf ) objLogFile.Close Function CountFolders (ByVal StrFolder) Dim ParentFld Dim SubFld Dim IntCount Set ParentFld = fs.GetFolder (StrFolder) IntCount = ParentFld.SubFolders.Count For Each SubFld In ParentFld.SubFolders IntCount = IntCount + CountFolders(SubFld.Path) Next CountFolders = IntCount End Function Function FolderSize (ByVal StrFolder) Dim ParentFld Dim IntCount Set ParentFld = fs.GetFolder (StrFolder) IntCount = ParentFld.size FolderSize = IntCount End Function Function CountFiles (ByVal StrFolder) Dim ParentFld Dim SubFld Dim IntCount Set ParentFld = fs.GetFolder (StrFolder) IntCount = ParentFld.Files.Count For Each SubFld In ParentFld.SubFolders IntCount = IntCount + CountFiles(SubFld.Path) Next CountFiles = IntCount End Function [/QUOTE]
Insert quotes…
Verification
Post reply
Top