Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

VBS: The Output Files of the code below sort them in the following manner: . Is there a way to get this output to be

VBS: The Output Files of the code below sort them in the following manner: image text in transcribed.

Is there a way to get this output to be sorted into organized columns such as DATE, TIME and FILE LOCATION instead?

' PURPOSE: Find files based upon their last modified date ' Parameters: ' 1 - folder path of where to search for files ' 2 - # of days older than to search for ' 3 - Recursive (Searches inside folders) or ' Non-Recursive (Searches only at the level specified) ' ' Ex: $searchfiles.vbs "c:\users\example\desktop" 10 r '

Set CmdArg_Object = Wscript.Arguments Select Case (CmdArg_Object.Count) Case 3 sDirectoryPath = CmdArg_Object.item(0) Search_Days = CmdArg_Object.item(1) r_nr = CmdArg_Object.item(2) Case Else WScript.Echo "SearchFiles.vbs requires 3 parameters:" &_ vbcrlf & "1) Folder Path" &_ vbcrlf & "2) # Days to Search" &_ vbcrlf & "3) Recursive option (rr)" WScript.Quit End Select

Set oFSO = CreateObject("Scripting.FileSystemObject") iDaysOld=Date+(-1*Search_Days) Inp= InputBox("Please Enter Desired Location of Log File:") If Inp= "" Then Set oTF = oFSO.CreateTextFile("C:output.txt") Else Set oTF = oFSO.CreateTextFile(oFSO.BuildPath(Inp,"output.txt")) End If Set oFolder = oFSO.GetFolder(sDirectoryPath) Set oFileCollection = oFolder.Files

WScript.Echo Now & " - Beginning " & Search_Days & " day search of " & sDirectoryPath

If r_nr = "r" Then oTF.WriteLine ("Search Parameters-") &_ vbcrlf & "DirectoryPath: " & sDirectoryPath &_ vbcrlf & "Older than: " & Search_Days &" Days " &_ vbcrlf & "Recursive/Non-Recursive: " & r_nr &_ vbcrlf & "------------------ " TraverseFolders oFSO.GetFolder(sDirectoryPath)

Function TraverseFolders (FolderName) For Each SubFolder In FolderName.SubFolders For Each oFile In SubFolder.Files lastModDate = oFile.DateLastModified If (lastModDate

Else oTF.WriteLine ("Search Parameters:") &_ vbcrlf & "DirectoryPath: " & sDirectoryPath &_ vbcrlf & "Older than: " & Search_Days &" Days " &_ vbcrlf & "Recursive/Non-Recursive: " & r_nr &_ vbcrlf & "------------------------- " For Each oFile In oFileCollection lastModDate = oFile.DateLastModified If (lastModDate

If Inp="" Then WScript.Echo "Now - Finished! Results Placed in: C:output.txt" Else WScript.Echo "Now - Finished! Results Placed in: " & Inp End If

output - Notepad File Edit Format View Search Parameters-- DirectoryPath: c:users\Ex\desktop older than: 10 Recursive/Non-Recursive: r 7/22/2016 6:55:16 PM C:\users\EX\Desktop LED FAN LED Fan Editor LedFan. exe 7/22/2016 6:55:17 PM C:\Users EX\Desktop\ LED FAN LED Fan Editor\SkinHu. d11 7/22/2016 6:55:17 PM C\UsersEDesktop\ LED FAN LED Fan Editor LIB\ LedFan. Ini 7/22/2016 6:55:17 PM C:\Users EX Desktop\LED FAN LED Fan Editor LIB\ LedFanvi 7/22/2016 6:55:17 PM C:\users EX Desktop\LED FAN LED Fan Editor LIB She. d1l 7/22/2016 6:55:17 PM C:\UsersEXDesktop LED FAN LED Fan Editor LIB skin. she 7/22/2016 6:55:17 PM C:\Users\EX\Desktop LED FAN LED Fan Editor LIB\ the_11ASCII.bin 7/22/2016 6:55:17 PM C\UsersEDesktop LED FAN LED Fan Editor\LIB\the_11ASCIIX. bin 7/22/2016 6:55:17 PM C\Users EX\Desktop LED FAN LED Fan Editor LIB\the 11FH. bin 7/22/2016 6:55:17 PM c:\Users EXDesktop LED FAN LED Fan Editor\LIB the 16ASCII.bin 7/22/2016 6:55:17 PM C:\UsersEXDesktop LED FAN LED Fan Editor LIB\the_16FH. bin 7/22/2016 6:55:17 PM C:\UsersEDesktop LED FAN LED Fan Editor LIB\ THE_7ASCII.bin 7/22/2016 6:55:17 PM C\UsersDesktop LED FAN LED Fan Editor LIB\UserzK11.fnt 7/22/2016 6:55:18 PM C:\users EX Desktop\ LED FAN LED Fan Editor LIB\ UserZK16. fnt 7/22/2016 6:55:17 PM C:users\EXDesktop LED FAN LED Fan Editor LIB\WxkusB. d11

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

Describe the seven standard parts of a letter.

Answered: 1 week ago

Question

Explain how to develop effective Internet-based messages.

Answered: 1 week ago

Question

Identify the advantages and disadvantages of written messages.

Answered: 1 week ago